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

IopcPcClassStore Class Reference

This class stores information about persistent capable classes. It also defines which attributes are (potentially) persistent. More...

#include <iopcPcClassStore.h>

Inheritance diagram for IopcPcClassStore:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 IopcPcClassStore ()
void addBaseClassInfo (const char *className, const char *baseClassName)
int addAttribute (const char *className, const char *attrName, TypeInfo &attrTypeInfo, AccessSpecifier access, const char *hint, const bool declaredInAncestor, const bool persistent)
bool isClassPersistent (const char *className)
bool isAttributePersistent (const char *className, const char *attrName)
bool canDereferenceAttribute (const char *className, const char *attrName)

Static Public Member Functions

bool isPersistentType (TypeInfo &typeInfo)
IopcAttributeInfo occTypeToIopcType (TypeInfo &typeInfo)

Protected Member Functions

IopcPcClassInfogetClass (const char *className, bool addIfNotPresent)

Protected Attributes

std::vector< IopcPcClassInfoclasses
int lastClassIndex

Detailed Description

This class stores information about persistent capable classes. It also defines which attributes are (potentially) persistent.

To add persistence of currently non-persistent data type modify function isPersistentType(). If you will not make any other changes to IOPC SP, iopcImport() and iopcExport() functions will be called on the attribute when loading it from / saving it to database. See IopcTranslatingSupport::createImportAttributesFnc(), IopcTranslatingSupport::createExportAttributesFnc().

All functions that need to access information about one concrete class use function getClass().


Constructor & Destructor Documentation

IopcPcClassStore::IopcPcClassStore  ) 
 

Simple constructor.


Member Function Documentation

void IopcPcClassStore::addBaseClassInfo const char *  className,
const char *  baseClassName
 

Adds to information about persistent capable class className name of one of its parents - baseClassName.

int IopcPcClassStore::addAttribute const char *  className,
const char *  attrName,
TypeInfo attrTypeInfo,
AccessSpecifier  access,
const char *  hint,
const bool  declaredInAncestor,
const bool  persistent
 

Adds to information about persistent capable class className information about its attribute.

If attribute name (attrName) is already used by an attribute declared in this class, prints an error message and returns 1.

Parameters:
className Name of the class.
attrName Name of the attribute.
attrTypeInfo OpenC++ representation of attribute type.
access The attribute's access specification.
hint String to be duplicated and stored in IopcAttributeInfo::hint.
declaredInAncestor Set if attribute is not declared in class className but in some of its ancestors.
persistent Is the attribute (potentially) persistent?
Returns:
0 if OK, 1 in case of error

bool IopcPcClassStore::isClassPersistent const char *  className  ) 
 

Tests whether the class is persistent capable (i.e. it has been already added to this object).

bool IopcPcClassStore::isAttributePersistent const char *  className,
const char *  attrName
 

Tests whether attribute attrName of class className is persistent.

bool IopcPcClassStore::canDereferenceAttribute const char *  className,
const char *  attrName
 

Tests whether potentially persistent attribute attrName of class className is some kind of pointer i.e. whether it can be dereferenced.

Returns:
Currently returns true for attributes of type IOPC_STRING and IOPC_WSTRING, for other attributes returns false.

bool IopcPcClassStore::isPersistentType TypeInfo typeInfo  )  [static]
 

Returns true if type represented by typeInfo is potentially persistent, in the other case returns false.

This is the only function that user HAVE TO modify if he wants to add persistence support for a new data type. See general information about this class for details.

Parameters:
typeInfo OpenC++ representation of attribute type.

IopcAttributeInfo IopcPcClassStore::occTypeToIopcType TypeInfo typeInfo  )  [static]
 

Converts Open C++ representation of attribute type to IOPC SP representation.

Note:
For unknown data types returns IOPC_COMPLEX_DATA_TYPE.

IopcPcClassInfo * IopcPcClassStore::getClass const char *  className,
bool  addIfNotPresent
[inline, protected]
 

Finds information about class className in this IopcPcClassStore. If the class is not found and addIfNotPresent is set, adds the class (only class name information).

If classes[lastClassIndex] is valid and points to class with specified name, returns pointer to it. In the other case sequentially tests all classes in classes until it finds the class.

Returns:
Pointer to the class if found (or added), NULL in the other case.


Member Data Documentation

std::vector<IopcPcClassInfo> IopcPcClassStore::classes [protected]
 

Array of information about persistent capable classes.

int IopcPcClassStore::lastClassIndex [protected]
 

Index of most recently used class.


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