#include <metadataInitializer.h>
Public Member Functions | |
virtual void | initializeMetadata ()=0 |
Implementations should set the class metadata or global settings here. |
Class metadata can be initialized in two standard ways: either by implementing the static void iopcInit(iopc::Type& t) or by passing an instance of a MetadataInitializer implementation to IopcMeta::init(MetadataInitializer* metadataInitializer) Only these two ways guarantee that the class metadata will be set properly and that they will have desired effect on the program execution.
Example:
class OurMetadataInitializer : public MetadataInitializer { public: virtual void initializeMetadata() { globalSettings["db.oracle.oidSequence.name"].setStringValue("OIDS"); TypeDesc<MyType>::getType()["db.table"].setStringValue("MYTABLE"); ... }; ... int main(int argc, char *argv[]) { Iopc::init(new OurMetadataInitializer(), LogWriter::ERROR ... ); ... }
virtual void iopc::MetadataInitializer::initializeMetadata | ( | ) | [pure virtual] |
Implementations should set the class metadata or global settings here.
Typical implementation would load metadata from a configuration file and use TypeManager and related classes to set them on matching classes and attributes.
Implemented in iopc::TextFileMetadataLoader.