|
From: <mk...@us...> - 2003-04-11 18:16:25
|
Update of /cvsroot/csp/APPLICATIONS/SimData/Include/SimData
In directory sc8-pr-cvs1:/tmp/cvs-serv14969/Include/SimData
Added Files:
DataManager.h FileUtility.h Quaternion.i
Log Message:
--- NEW FILE: DataManager.h ---
/* SimDataCSP: Data Infrastructure for Simulations
* Copyright (C) 2002 Mark Rose <tm...@st...>
*
* This file is part of SimDataCSP.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* @file DataManager.h
* @author Mark Rose <mr...@st...>
*/
#ifndef __DATAMANAGER_H__
#define __DATAMANAGER_H__
# if defined(_MSC_VER) && (_MSC_VER <= 1200)
#pragma warning(disable : 4786)
# endif
#include <string>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <SimData/Path.h>
#include <SimData/HashUtility.h>
#include <SimData/ns-simdata.h>
NAMESPACE_SIMDATA
class DataArchive;
/**
* Class for managing read access to multiple data archives.
*
* @author Mark Rose <mr...@st...>
*/
class SIMDATA_EXPORT DataManager {
friend class DataArchive;
public:
/**
* Construct a new (empty) data manager.
*/
DataManager();
/**
* Destroy the data manager and all the archives it contains.
*/
virtual ~DataManager();
/**
* Create a new object from a path identifier string.
*
* @path_str the path identifier string.
* @returns a smart-pointer to the new object.
*/
const PointerBase getObject(const char* path_str);
/**
* Create a new object from a Path instance.
*
* @path the Path instance.
* @path_str the path identifier string (if available). This is
* only used for error logging.
*/
const PointerBase getObject(Path const& path, const char* path_str=0);
/**
* Add a new data archive to the manager.
*
* All objects in the archive will subsequently be available from the
* manager. The manager "owns" the pointer and will delete it when the
* manager is destroyed.
*/
void addArchive(DataArchive *);
private:
/**
* Create a new object from a Path instance.
*
* For internal use by the DataArchive class. When a particular
* DataArchive class fails to find an object, it asks the associated
* Manager to create the object. The last parameter is used to
* prevent unwanted recursion if an object isn't found.
*
* @path the Path instance.
* @path_str the path identifier string (if available). This is
* only used for error logging.
* @d the data archive that is requesting the object.
*/
const PointerBase getObject(Path const& path, const char* path_str, DataArchive* d);
std::vector<DataArchive*> archives;
hasht_map archive_map;
};
NAMESPACE_END // namespace simdata
#endif //__DATAMANAGER_H__
--- NEW FILE: FileUtility.h ---
/* SimDataCSP: Data Infrastructure for Simulations
* Copyright (C) 2002 Mark Rose <tm...@st...>
*
* This file is part of SimDataCSP.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* @file FileUtility.h
*
* Platform independent file utilities.
*/
#ifndef __FILEUTILITY_H__
#define __FILEUTILITY_H__
#include <string>
#include <SimData/Export.h>
#include <SimData/ns-simdata.h>
NAMESPACE_SIMDATA
namespace ospath {
extern SIMDATA_EXPORT const char DIR_SEPARATOR;
extern SIMDATA_EXPORT const char PATH_SEPARATOR;
/**
* Return the basename of pathname path.
*
* Example: basename("/usr/local/csp") returns "csp"
*/
extern SIMDATA_EXPORT std::string basename(const std::string &path);
/**
* Returns true if path is an absolute pathname.
*/
extern SIMDATA_EXPORT bool isabs(const std::string &path);
/**
* Strips leading drive specifier and root directory marker.
*
* Examples:
* skiproot("c:\\windows") == "windows"
* skiproot("/linux/csp") == "linux/csp"
*/
extern SIMDATA_EXPORT std::string skiproot(const std::string &path);
/**
* Returns the directory name of pathname path.
*
* Example: dirname("/usr/local/csp") returns "/usr/local"
*/
extern SIMDATA_EXPORT std::string dirname(const std::string &path);
/**
* Returns the current working directory.
*/
extern SIMDATA_EXPORT std::string currentdir();
/**
* Returns the (last) extension of pathname path.
*
* Example: ext("/usr/local/script.csp") returns ".csp"
*/
extern SIMDATA_EXPORT std::string ext(const std::string &path);
/**
* Intelligently joins two path components into a pathname.
*
* Examples:
* join("/usr/local", "lib") returns "/usr/local/lib"
* join("c:\\windows\\", "system") returns "c:\\windows\\system"
*/
extern SIMDATA_EXPORT std::string join(const std::string &a, const std::string &b);
/**
* Substitute characters in a string.
*
* This routine is slightly out of place. Can we find a substitute or better
* home for it?
*
* @param path The path to modify.
* @param search The character to replace.
* @param replace The replacement character.
*/
extern SIMDATA_EXPORT std::string stringreplace(const std::string &path, char search, char replace);
/**
* Convert a native path to a standard format (uses '/' instead of '\')
*
* Note: does *not* handle directory names under windows.
*/
extern SIMDATA_EXPORT std::string normalize(const std::string &path);
/**
* Convert a normalized path to the native format.
*/
extern SIMDATA_EXPORT std::string denormalize(const std::string &path);
/**
* Filter an input path to use the native directory separation character.
*/
extern SIMDATA_EXPORT std::string filter(const std::string &path);
/**
* Add a path to a list of paths using the platform path separator.
*/
extern SIMDATA_EXPORT std::string const &addpath(std::string &pathlist, const std::string &path);
} // namespace ospath
NAMESPACE_END // namespace simdata
#endif // __FILEUTILITY_H__
--- NEW FILE: Quaternion.i ---
%module Quaternion
%{
#include "SimData/Quaternion.h"
%}
%include "std_string.i"
%include "std_vector.i"
%include "SimData/ns-simdata.h"
%rename(__repr__) SIMDATA(Quaternion)::asString() const;
%include "SimData/Quaternion.h"
|