Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

MetadataWriter Class Reference

Interface for class that saves metadata (information about application's class model). More...

#include <MetadataWriter.h>

Inheritance diagram for MetadataWriter:

Inheritance graph
[legend]
List of all members.

Public Member Functions

virtual void initialize (const char *projectName, const char *locationCommonPart, IopcMappingType defaultMappingType, const void *implSpecificParam)
virtual int addClass (const char *className, const BaseClassesList &baseClasses, const ClassAttributeList &classAttributes, const char *sourceFileName, CStdString &tmpDataLocation, const char *hint, CStdString &warningsForUser, CStdString &errorForUser)=0
virtual int saveMetadata (const std::list< CStdString > &tmpDataLocations, const char *metadataLocation, CStdString &warningsForUser, CStdString &errorForUser)=0

Protected Member Functions

 MetadataWriter ()

Protected Attributes

CStdString m_projectName
CStdString m_locationCommonPart
IopcMappingType m_defaultMappingType
bool m_initialized

Detailed Description

Interface for class that saves metadata (information about application's class model).

An ancestor of this class is called after parsing a declaration of C++ class in IOPC SP - it has to remember acquired information (addClass()) . Because writing the data directly into metadata final location can be a time consuming action and typical C++ aplication contains more than one .cpp file, MetadataWriter should write the data to some temporal storage (temporal file etc.) and later "link" (put together) data from all these temporal storages to get final representation of class model of the whole application (saveMetadata()).

Metadata can be loaded later by MetadataLoader. For each class that implements this interface there should be one ancestor of MetadataLoader that is able to load data saved by the class.

To distinguish between different project / applications, initialize() takes string parameter projectName. Of course, projectName must be the same for all files belonging to one project / application.

It's necessary to call initialize() before calling any other MetadataWriter's method.


Constructor & Destructor Documentation

MetadataWriter::MetadataWriter  )  [inline, protected]
 

Simple constructor.


Member Function Documentation

virtual void MetadataWriter::initialize const char *  projectName,
const char *  locationCommonPart,
IopcMappingType  defaultMappingType,
const void *  implSpecificParam
[inline, virtual]
 

Remembers projectName, locationCommonPart and defaultMappingType in m_projectName, m_locationCommonPart and m_defaultMappingType, ignores implSpecificParam.

Parameters:
projectName Used to distinguish between different projects / applications. Of course, projectName must be the same for all files belonging to one project / application. projectName will be typically used when generating location (file name, table name ...) where the metadata will be stored if location isn't explicitly given.
locationCommonPart Specifies common part of location where the MetadataWriter should store metadata (f.e. directory in which the files should be created).
defaultMappingType Default class mapping type.
implSpecificParam Can be used for any purpose. For example to store parameters of DB connection if saving metadata to DB, or to get name of the file, that should be metadata written into....

Reimplemented in XMLMetadataWriter.

virtual int MetadataWriter::addClass const char *  className,
const BaseClassesList baseClasses,
const ClassAttributeList classAttributes,
const char *  sourceFileName,
CStdString &  tmpDataLocation,
const char *  hint,
CStdString &  warningsForUser,
CStdString &  errorForUser
[pure virtual]
 

Stores metadata information about given class at some temporary location.

See MetadataWriter's class description for details.

Note:
MetadataWriter cannot keep the information only in memory, it should write it to some temporary file or table etc. Function saveMetadata() will be called probably later - on another instance of this object.
Parameters:
className Name of the class.
baseClasses List of class parents.
classAttributes List of class attributes.
sourceFileName File where this class have been found (.cpp file, not .h). Can be used when generating temporary file / table / ... name
tmpDataLocation Location where MetadataWriter had saved the temporary data.
hint Hint for MetadataWriter. Can be used for any purposes.
warningsForUser String used to send warning message(s) to user if needed.
errorForUser String used to send an error message to user if needed.
Returns:
0 if OK, non-zero in case of error.
See also:
saveMetadata()

Implemented in XMLMetadataWriter.

virtual int MetadataWriter::saveMetadata const std::list< CStdString > &  tmpDataLocations,
const char *  metadataLocation,
CStdString &  warningsForUser,
CStdString &  errorForUser
[pure virtual]
 

Puts all information from MetadataWriter's temporary storages together and saves whole application object model in place specified by location.

See MetadataWriter's class description for details.

Parameters:
tmpDataLocations List of locations returned by addClass() in parameter tmpDataLocation. If empty, MetadataWriter should try to read all the data in location m_locationCommonPart, if it is also empty, MetadataWriter could try to get the data from some default location.
metadataLocation Location where the metadata should be stored (f. e. file or DB table name)
warningsForUser String used to send warning message(s) to user if needed.
errorForUser String used to send an error message to user if needed.
Returns:
0 if OK, non-zero in case of error.
See also:
addClass()

Implemented in XMLMetadataWriter.


Member Data Documentation

CStdString MetadataWriter::m_projectName [protected]
 

Project name.
See initialize() for details.

CStdString MetadataWriter::m_locationCommonPart [protected]
 

Common part of location where metadata should be stored.
See initialize() for details.

IopcMappingType MetadataWriter::m_defaultMappingType [protected]
 

Default mapping type.
See initialize() for details.

bool MetadataWriter::m_initialized [protected]
 

Have initialize() been called?


The documentation for this class was generated from the following file:
Generated on Wed Aug 11 22:35:53 2004 for IOPC by Doxygen 1.3.6