| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

XmlBaseConditionCnv Class Reference

XML converter for Conditions. More...

#include <XmlBaseConditionCnv.h>

Inheritance diagram for XmlBaseConditionCnv:

[legend]
Collaboration diagram for XmlBaseConditionCnv:
[legend]
List of all members.

Public Types

 INVALID_ADDRESS
 INVALID_OBJECT
 NO_MEMORY
 BAD_STORAGE_TYPE
 NO_SOURCE_OBJECT
 ICONVERSIONSVC_LAST_ERROR
 SUCCESS
 NO_INTERFACE
 VERSMISMATCH
 LAST_ERROR
enum  Status

Public Member Functions

virtual StatusCode initialize ()
 Initializes the converter - Overrides the default method in XmlGenericCnv.
virtual StatusCode finalize ()
 Finalizes the converter.
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&refpObject)
 Creates the transient representation of an object.
virtual StatusCode updateObj (IOpaqueAddress *pAddress, DataObject *pObject)
 Updates the transient object from the other representation.
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Converts the transient object to the requested representation.
virtual StatusCode updateRep (IOpaqueAddress *pAddress, DataObject *pObject)
 Updates the converted representation of a transient object.
IXmlSvcxmlSvc ()
 Accessor to the IXmlSvc interface of the XmlCnvSvc service.
virtual long repSvcType () const
 Accessor to the StorageType value.
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
virtual unsigned long addRef ()
virtual unsigned long release ()
virtual StatusCode setDataProvider (IDataProviderSvc *svc)
virtual IDataProviderSvcdataProvider () const
virtual StatusCode setConversionSvc (IConversionSvc *svc)
virtual IConversionSvcconversionSvc () const
virtual StatusCode setAddressCreator (IAddressCreator *creator)
virtual IAddressCreatoraddressCreator () const
virtual const CLIDobjType () const
virtual long i_repSvcType () const
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
virtual StatusCode updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
StatusCode service (const std::string &name, T *&psvc, bool createIf=false) const
StatusCode service (const std::string &type, const std::string &name, T *&psvc) const

Static Public Member Functions

static const CLIDclassID ()
 accessor to the type of elements that this converter converts
static long storageType ()
 Accessor to the StorageType value.
static const InterfaceIDinterfaceID ()

Public Attributes

 INVALID_ADDRESS
 INVALID_OBJECT
 NO_MEMORY
 BAD_STORAGE_TYPE
 NO_SOURCE_OBJECT
 ICONVERSIONSVC_LAST_ERROR

Protected Member Functions

 XmlBaseConditionCnv (ISvcLocator *svcs)
 Constructor for this converter.
 XmlBaseConditionCnv (ISvcLocator *svc, const CLID &clsID)
 Constructor for this converter.
virtual ~XmlBaseConditionCnv ()
 Default destructor.
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolves the references of the created transient object.
virtual StatusCode updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolves the references of the just updated transient object.
virtual StatusCode i_createObj (xercesc::DOMElement *element, DataObject *&refpObject)
 Creates the transient representation of an object from a DOMElement.
virtual StatusCode i_fillObj (xercesc::DOMElement *childElement, DataObject *refpObject, IOpaqueAddress *address)
 Fills the current object for its child element childElement.
virtual StatusCode i_fillSpecificObj (xercesc::DOMElement *childElement, Condition *refpObject, IOpaqueAddress *address)=0
 This fills the current object for specific child.
virtual StatusCode internalCreateObj (xercesc::DOMElement *element, DataObject *&refpObject, IOpaqueAddress *address)
 This creates the transient representation of an object from the DOMElement representing it, then fills it and process it.
virtual StatusCode i_fillObj (xercesc::DOMText *childText, DataObject *pObject, IOpaqueAddress *address)
 This fills the current object for its child text node childText.
virtual StatusCode i_processObj (DataObject *pObject, IOpaqueAddress *address)
 This is called after the current object was filled.
IOpaqueAddresscreateAddressForHref (std::string href, CLID clid, IOpaqueAddress *parent) const
 This parses a href attribute string and creates an address out of it Currently, two types of references are understood : regular URLs and references starting with "conddb:/".
IOpaqueAddresscreateXmlAddress (std::string location, std::string entryName, CLID clid) const
 This creates an XmlAddress using the location, entryName and clid.
IOpaqueAddresscreateCondDBAddress (std::string path, std::string entryName, unsigned long channelId, CLID clid) const
 This creates a ConddbAddress using the location, entryName, channelID and clid.
ISvcLocatorserviceLocator () const
IMessageSvcmsgSvc () const
IMessageSvcmessageService () const
IDataManagerSvcdataManager () const

Static Protected Member Functions

static const std::string dom2Std (const XMLCh *domString)
 builds a standard string from a XMLCh*

Protected Attributes

IXmlSvcm_xmlSvc
 the IXmlSvc interface of this object

Private Member Functions

template<class T>
i_convert (const XMLCh *value)
template<class T>
i_convert (const std::string &value)
template<class T>
i_convertVect (XMLCh *value)
template<class K, class V>
std::map< K, V > i_makeMap (xercesc::DOMNodeList *entries)

Private Attributes

bool m_doGenericCnv
 Whether to use the generic converter in case a specific one does not exist.
const XMLCh * specificString
const XMLCh * paramString
const XMLCh * paramVectorString
const XMLCh * mapString
const XMLCh * itemString
const XMLCh * typeString
const XMLCh * nameString
const XMLCh * commentString
const XMLCh * keytypeString
const XMLCh * valuetypeString
const XMLCh * keyString
const XMLCh * valueString

Detailed Description

XML converter for Conditions.

Author:
Sebastien Ponce

Definition at line 25 of file XmlBaseConditionCnv.h.


Constructor & Destructor Documentation

XmlBaseConditionCnv::XmlBaseConditionCnv ( ISvcLocator svcs  )  [protected]

Constructor for this converter.

Parameters:
svcs a ISvcLocator interface to find services

XmlBaseConditionCnv::XmlBaseConditionCnv ( ISvcLocator svc,
const CLID clsID 
) [protected]

Constructor for this converter.

Parameters:
svc a ISvcLocator interface to find services
clsID the type of object the converter is able to convert

virtual XmlBaseConditionCnv::~XmlBaseConditionCnv (  )  [protected, virtual]

Default destructor.


Member Function Documentation

virtual StatusCode XmlBaseConditionCnv::initialize (  )  [virtual]

Initializes the converter - Overrides the default method in XmlGenericCnv.

Returns:
status depending on the completion of the call

Reimplemented from XmlGenericCnv.

static const CLID& XmlBaseConditionCnv::classID (  )  [static]

accessor to the type of elements that this converter converts

Returns:
the classID for this type

Reimplemented in XmlUserConditionCnv< DeType >.

virtual StatusCode XmlBaseConditionCnv::fillObjRefs ( IOpaqueAddress pAddress,
DataObject pObject 
) [protected, virtual]

Resolves the references of the created transient object.

Reimplemented from Converter.

virtual StatusCode XmlBaseConditionCnv::updateObjRefs ( IOpaqueAddress pAddress,
DataObject pObject 
) [protected, virtual]

Resolves the references of the just updated transient object.

Reimplemented from Converter.

virtual StatusCode XmlBaseConditionCnv::i_createObj ( xercesc::DOMElement *  element,
DataObject *&  refpObject 
) [protected, virtual]

Creates the transient representation of an object from a DOMElement.

Overrides the default method in XmlGenericCnv

Parameters:
element the DOMElement to be used to builds the object
refpObject the object to be built
Returns:
status depending on the completion of the call

Reimplemented from XmlGenericCnv.

Reimplemented in XmlUserConditionCnv< DeType >.

virtual StatusCode XmlBaseConditionCnv::i_fillObj ( xercesc::DOMElement *  childElement,
DataObject refpObject,
IOpaqueAddress address 
) [protected, virtual]

Fills the current object for its child element childElement.

Overrides the default method in XmlGenericCnv

Parameters:
childElement the child processed here
refpObject the object to be filled
address the address for this object
Returns:
status depending on the completion of the call

Reimplemented from XmlGenericCnv.

virtual StatusCode XmlBaseConditionCnv::i_fillSpecificObj ( xercesc::DOMElement *  childElement,
Condition refpObject,
IOpaqueAddress address 
) [protected, pure virtual]

This fills the current object for specific child.

Specific children are children of children <specific> of the <condition> tag. This is typically used for specializing consditions and define new properties. This will be called for each specific child of the current object

Parameters:
childElement the specific child processed here
refpObject the object to be filled
address the address for this object
Returns:
status depending on the completion of the call

Implemented in XmlUserConditionCnv< DeType >.

template<class T>
T XmlBaseConditionCnv::i_convert ( const XMLCh *  value  )  [inline, private]

Definition at line 130 of file XmlBaseConditionCnv.h.

00130                                         {
00131     return (T)xmlSvc()->eval(i_convert<std::string>(value), false);
00132   }

template<class T>
T XmlBaseConditionCnv::i_convert ( const std::string &  value  )  [inline, private]

Definition at line 135 of file XmlBaseConditionCnv.h.

00135                                             {
00136     return (T)xmlSvc()->eval(value, false);
00137   }

template<class T>
T XmlBaseConditionCnv::i_convertVect ( XMLCh *  value  )  [inline, private]

Definition at line 140 of file XmlBaseConditionCnv.h.

00140                                       {
00141     std::vector<T> v;
00142     std::istringstream cstr(i_convert<std::string>(value));
00143     std::string itemval;
00144     while (cstr >> itemval) {
00145       v.push_back(i_convert<T>(itemval));
00146     }
00147     return v;
00148   }

template<class K, class V>
std::map<K,V> XmlBaseConditionCnv::i_makeMap ( xercesc::DOMNodeList *  entries  )  [inline, private]

Definition at line 151 of file XmlBaseConditionCnv.h.

00151                                                     {
00152     std::map<K,V> map;
00153     XMLSize_t i;
00154     for (i = 0; i < entries->getLength(); i++) {
00155       xercesc::DOMNode* entryNode = entries->item(i);
00156       if (entryNode->getNodeType() == xercesc::DOMNode::ELEMENT_NODE) {
00157         xercesc::DOMElement* entry = static_cast<xercesc::DOMElement*>(entryNode);
00158         map[i_convert<K>(entry->getAttribute(keyString))] =
00159           i_convert<V>(entry->getAttribute(valueString));
00160       }
00161     }
00162     return map;
00163   }

virtual StatusCode XmlGenericCnv::finalize (  )  [virtual, inherited]

Finalizes the converter.

Returns:
status depending on the completion of the call

Reimplemented from Converter.

virtual StatusCode XmlGenericCnv::createObj ( IOpaqueAddress addr,
DataObject *&  refpObject 
) [virtual, inherited]

Creates the transient representation of an object.

Parameters:
addr the address of the object representation
refpObject the object created
Returns:
status depending on the completion of the call

Reimplemented from Converter.

virtual StatusCode XmlGenericCnv::updateObj ( IOpaqueAddress pAddress,
DataObject pObject 
) [virtual, inherited]

Updates the transient object from the other representation.

Parameters:
pAddress the address of the object representation
pObject the object updated
Returns:
status depending on the completion of the call

Reimplemented from Converter.

virtual StatusCode XmlGenericCnv::createRep ( DataObject pObject,
IOpaqueAddress *&  refpAddress 
) [virtual, inherited]

Converts the transient object to the requested representation.

Parameters:
refpAddress the address of the object representation
pObject the object to convert
Returns:
status depending on the completion of the call

Reimplemented from Converter.

virtual StatusCode XmlGenericCnv::updateRep ( IOpaqueAddress pAddress,
DataObject pObject 
) [virtual, inherited]

Updates the converted representation of a transient object.

Parameters:
pAddress the address of the object representation
pObject the object whose representation has to be updated
Returns:
status depending on the completion of the call

Reimplemented from Converter.

IXmlSvc* XmlGenericCnv::xmlSvc (  )  [inline, inherited]

Accessor to the IXmlSvc interface of the XmlCnvSvc service.

Returns:
the IXmlSvc interface of this object

status depending on the completion of the call

Definition at line 91 of file XmlGenericCnv.h.

00091                     {
00092     if (!m_xmlSvc) m_xmlSvc = dynamic_cast<IXmlSvc*>(conversionSvc());
00093     return m_xmlSvc;
00094   }

static long XmlGenericCnv::storageType (  )  [inline, static, inherited]

Accessor to the StorageType value.

Returns:
the storage type for this object

Definition at line 100 of file XmlGenericCnv.h.

00100                             {
00101     return XML_StorageType;
00102   }

virtual long XmlGenericCnv::repSvcType (  )  const [inline, virtual, inherited]

Accessor to the StorageType value.

Returns:
the storage type for this object

Implements Converter.

Definition at line 108 of file XmlGenericCnv.h.

00108                                    {
00109     return XML_StorageType;
00110   }

virtual StatusCode XmlGenericCnv::internalCreateObj ( xercesc::DOMElement *  element,
DataObject *&  refpObject,
IOpaqueAddress address 
) [protected, virtual, inherited]

This creates the transient representation of an object from the DOMElement representing it, then fills it and process it.

This implementation actually only calls the i_* methods to do the job. Most of the converters don't need to override it but only to override/implement some of the i_* methods.

Parameters:
element the DOMElement to be used to builds the object
refpObject the object to be built
address the address for this object
Returns:
status depending on the completion of the call

virtual StatusCode XmlGenericCnv::i_fillObj ( xercesc::DOMText *  childText,
DataObject pObject,
IOpaqueAddress address 
) [protected, virtual, inherited]

This fills the current object for its child text node childText.

This will be called for each text child of the current object

Parameters:
childText the child processed here
pObject the object to be filled
address the address for this object
Returns:
status depending on the completion of the call

virtual StatusCode XmlGenericCnv::i_processObj ( DataObject pObject,
IOpaqueAddress address 
) [protected, virtual, inherited]

This is called after the current object was filled.

This is were some computation based on the object content could be done

Parameters:
pObject the object to be processed
address the address for this object
Returns:
status depending on the completion of the call

IOpaqueAddress* XmlGenericCnv::createAddressForHref ( std::string  href,
CLID  clid,
IOpaqueAddress parent 
) const [protected, inherited]

This parses a href attribute string and creates an address out of it Currently, two types of references are understood : regular URLs and references starting with "conddb:/".

The former create addresses with storage type XML_StorageType, the later addresses with storage type CONDDB_StorageType.

Parameters:
href the string contained in the href attribute
clid the clid of the address to create
parent the address of the dataObject that will contain the new object.
Returns:
the new Address

IOpaqueAddress* XmlGenericCnv::createXmlAddress ( std::string  location,
std::string  entryName,
CLID  clid 
) const [protected, inherited]

This creates an XmlAddress using the location, entryName and clid.

Parameters:
location the location string for this address
entryName the entryName string for this address
clid the clidof the address to create
Returns:
the new Address

IOpaqueAddress* XmlGenericCnv::createCondDBAddress ( std::string  path,
std::string  entryName,
unsigned long  channelId,
CLID  clid 
) const [protected, inherited]

This creates a ConddbAddress using the location, entryName, channelID and clid.

Parameters:
path the path string for this address
entryName the entryName string for this address
channelId the channelID for this address
clid the clidof the address to create
Returns:
the new Address

static const std::string XmlGenericCnv::dom2Std ( const XMLCh *  domString  )  [static, protected, inherited]

builds a standard string from a XMLCh*

Parameters:
domString the XMLCh*
Returns:
a standard string with the same characters


Member Data Documentation

bool XmlBaseConditionCnv::m_doGenericCnv [private]

Whether to use the generic converter in case a specific one does not exist.

Definition at line 110 of file XmlBaseConditionCnv.h.

const XMLCh* XmlBaseConditionCnv::specificString [private]

Definition at line 113 of file XmlBaseConditionCnv.h.

const XMLCh* XmlBaseConditionCnv::paramString [private]

Definition at line 114 of file XmlBaseConditionCnv.h.

const XMLCh* XmlBaseConditionCnv::paramVectorString [private]

Definition at line 115 of file XmlBaseConditionCnv.h.

const XMLCh* XmlBaseConditionCnv::mapString [private]

Definition at line 116 of file XmlBaseConditionCnv.h.

const XMLCh* XmlBaseConditionCnv::itemString [private]

Definition at line 117 of file XmlBaseConditionCnv.h.

const XMLCh* XmlBaseConditionCnv::typeString [private]

Definition at line 120 of file XmlBaseConditionCnv.h.

const XMLCh* XmlBaseConditionCnv::nameString [private]

Reimplemented from XmlGenericCnv.

Definition at line 121 of file XmlBaseConditionCnv.h.

const XMLCh* XmlBaseConditionCnv::commentString [private]

Definition at line 122 of file XmlBaseConditionCnv.h.

const XMLCh* XmlBaseConditionCnv::keytypeString [private]

Definition at line 123 of file XmlBaseConditionCnv.h.

const XMLCh* XmlBaseConditionCnv::valuetypeString [private]

Definition at line 124 of file XmlBaseConditionCnv.h.

const XMLCh* XmlBaseConditionCnv::keyString [private]

Definition at line 125 of file XmlBaseConditionCnv.h.

const XMLCh* XmlBaseConditionCnv::valueString [private]

Reimplemented from XmlGenericCnv.

Definition at line 126 of file XmlBaseConditionCnv.h.

IXmlSvc* XmlGenericCnv::m_xmlSvc [protected, inherited]

the IXmlSvc interface of this object

Definition at line 231 of file XmlGenericCnv.h.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:00:54 2011 for DetDescCnv by doxygen 1.4.7