9 #include "Reflex/Type.h"
13 std::string
className = dictionary.Name(Reflex::SCOPED);
14 Reflex::PropertyList classProps = dictionary.Properties();
23 const std::string& scopeName,
24 std::map<std::string, std::vector<MappingRawElement> >& innerElements ){
25 std::map<std::string,std::vector<MappingRawElement> >::iterator iScope = innerElements.find(scopeName);
26 if(iScope != innerElements.end()){
27 for( std::vector<MappingRawElement>::const_iterator iM = iScope->second.begin();
28 iM != iScope->second.end(); ++iM ){
34 std::string nextScope(scopeName);
35 nextScope.append(
"::").append(iM->variableName);
36 buildElement( element, nextScope, innerElements );
39 innerElements.erase(scopeName);
43 int newElemId = m_mappingSequence.getNextId();
53 iSubEl != element.
end(); ++iSubEl) {
54 unfoldElement( iSubEl->second, destination );
60 m_mappingSequence(
MappingRules::sequenceNameForMapping(), schema ),
70 m_mappingSequence.create();
76 m_schema.mappingSchema().getVersionList( m_versions );
80 std::string newMappingVersion =
"";
84 for ( std::set<std::string>::reverse_iterator iVersion = m_versions.rbegin();
85 iVersion != m_versions.rend(); ++iVersion ) {
86 if ( *iVersion == newMappingVersion ) {
92 m_versions.insert( newMappingVersion );
97 return newMappingVersion;
103 m_schema.mappingSchema().getVersionList( m_versions );
107 std::string newMappingVersion =
"";
111 for ( std::set<std::string>::reverse_iterator iVersion = m_versions.rbegin();
112 iVersion != m_versions.rend(); ++iVersion ) {
113 if ( *iVersion == newMappingVersion ) {
119 m_versions.insert( newMappingVersion );
124 return newMappingVersion;
130 if(m_schema.mappingSchema().getMapping( version, mapData )){
133 bool topLevelFound =
false;
134 bool dependency =
false;
135 std::map<std::string, std::vector<MappingRawElement> > innerElements;
136 for( std::map< int, MappingRawElement>::iterator iElem = mapData.
elements.begin();
137 iElem != mapData.
elements.end(); iElem++ ){
143 throwException(
"Mapping inconsistent.More then one top level element found.",
144 "MappingDatabase::getMappingByVersion");
146 topLevelElement = iElem->second;
148 topLevelFound =
true;
151 std::map<std::string, std::vector<MappingRawElement> >::iterator iN = innerElements.find( iElem->second.scopeName );
152 if(iN==innerElements.end()){
153 innerElements.insert( std::make_pair( iElem->second.scopeName, std::vector<MappingRawElement>(1,iElem->second) ) );
155 iN->second.push_back( iElem->second );
159 if( !topLevelFound ){
160 throwException(
"Could not find top element for mapping version \""+version+
"\".",
161 "MappingDatabase::getMappingByVersion" );
167 buildElement( topElement, topLevelElement.
variableName, innerElements );
174 m_schema.mappingSchema().removeMapping( version );
179 const std::string& classVersion,
187 bool found = m_schema.mappingSchema().selectMappingVersion( classId, containerId, version );
190 ret = getMappingByVersion( version, destination );
193 "MappingDatabase::getMappingForContainer");
196 throwException(
"Mapping inconsistency detected for version=\""+version+
"\"",
197 "MappingDatabase::getMappingForContainer");
208 std::string mappingVersion(
"");
209 bool found = m_schema.mappingSchema().selectMappingVersion( classId, containerId, mappingVersion );
212 ret = getMappingByVersion( mappingVersion, destination );
214 throwException(
"Mapping version \""+mappingVersion+
"\" not found.",
215 "MappingDatabase::getBaseMappingForContainer");
218 throwException(
"Mapping inconsistency detected for version=\""+mappingVersion+
"\"",
219 "MappingDatabase::getBaseMappingForContainer");
226 std::vector<MappingElement>& destination ){
228 std::set<std::string> versions;
229 if( m_schema.mappingSchema().getMappingVersionListForContainer( containerId, versions,
true ) ){
231 for( std::set<std::string>::iterator iM = versions.begin();
232 iM != versions.end(); ++iM ){
234 if( ! getMappingByVersion( *iM, mapping )){
236 "MappingDatabase::getDependentMappingsForContainer");
239 destination.push_back( mapping.
topElement() );
246 std::set<std::string>& destination ){
247 return m_schema.mappingSchema().getClassVersionListForMappingVersion( mappingVersion, destination );
251 const std::string& classVersion,
254 const std::string& mappingVersion,
257 m_schema.mappingSchema().insertClassVersion( className, classVersion, classId, dependencyIndex, containerId, mappingVersion );
264 std::map<std::string,std::string>& versionMap ){
266 return m_schema.mappingSchema().getClassVersionListForContainer( containerId, versionMap );
272 const std::string& mappingVersion,
274 std::string
className = dictionaryEntry.Name( Reflex::SCOPED );
275 std::string classVersion = versionOfClass( dictionaryEntry );
276 insertClassVersion( className, classVersion, depIndex, containerId, mappingVersion, asBase );
281 const std::string& mappingVersion,
283 std::string
className = dictionaryEntry.Name( Reflex::SCOPED );
284 std::string classVersion = versionOfClass( dictionaryEntry );
287 bool found = m_schema.mappingSchema().selectMappingVersion( classId, containerId, mv );
290 if( dependency ) depIndex = 1;
291 m_schema.mappingSchema().insertClassVersion( className, classVersion, classId, depIndex, containerId, mappingVersion );
293 m_schema.mappingSchema().setMappingVersion( classId, containerId, mappingVersion );
299 unfoldElement( mapping.
topElement(), rowMapping );
300 m_mappingSequence.sinchronize();
301 m_schema.mappingSchema().storeMapping( rowMapping );
305 return m_schema.mappingSchema().getMappingVersionListForContainer( containerId, versionList );
310 m_schema.mappingSchema().getVersionList( m_versions );
317 std::set<std::string>&
list ){
318 return m_schema.mappingSchema().getDependentClassesInContainerMapping( containerId, list );
bool getMappingForContainer(const std::string &className, const std::string &classVersion, int containerId, MappingTree &destination)
MappingDatabase(IDatabaseSchema &schema)
Constructor.
MappingRawElement & addElement(int elementId)
bool getDependentMappingsForContainer(int containerId, std::vector< MappingElement > &destination)
bool getBaseMappingForContainer(const std::string &className, int containerId, MappingTree &destination)
const std::string & className() const
std::vector< std::string > columns
static std::string newMappingVersionForContainer(const std::string &containerName, int iteration)
mapping versions
const std::string & variableName() const
static std::string dependencyMappingElementType()
Returns the name of the dependent class mapping element type.
bool getClassVersionListForMappingVersion(const std::string &mappingVersion, std::set< std::string > &destination)
void setMappingVersionForClass(const Reflex::Type &dictionaryEntry, int containerId, const std::string &mappingVersion, bool dependency=false)
const std::string & version() const
void buildElement(MappingElement &parentElement, const std::string &scopeName, std::map< std::string, std::vector< MappingRawElement > > &innerElements)
static std::string baseIdForClass(const std::string &className)
std::map< int, MappingRawElement > elements
void insertClassVersion(const Reflex::Type &dictionaryEntry, int dependencyIndex, int containerId, const std::string &mappingVersion, bool asBase=false)
ElementType elementType() const
void unfoldElement(const MappingElement &element, MappingRawData &destination)
MappingElement & setTopElement(const std::string &className, const std::string &tableName, bool isDependent=false)
std::string newMappingVersionForDependentClass(const std::string &containerName, const std::string &className)
MappingElement & appendSubElement(const std::string &elementType, const std::string &variableName, const std::string &variableType, const std::string &tableName)
bool getMappingVersionsForContainer(int containerId, std::set< std::string > &versionList)
void storeMapping(const MappingTree &mappingStructure)
iterator begin()
Returns an iterator in the beginning of the sequence.
static std::string elementTypeAsString(ElementType elementType)
Converts the enumeration type to a string.
static std::string defaultClassVersion(const std::string &className)
static std::string emptyScope()
const MappingElement & topElement() const
~MappingDatabase()
Destructor.
const std::vector< std::string > & columnNames() const
bool getClassVersionListForContainer(int containerId, std::map< std::string, std::string > &versionMap)
static std::string versionOfClass(const Reflex::Type &dictionary)
std::string newMappingVersionForContainer(const std::string &className)
bool getDependentClassesForContainer(int containerId, std::set< std::string > &list)
bool getMappingByVersion(const std::string &version, MappingTree &destination)
const std::set< std::string > & versions()
const std::string & variableType() const
std::map< std::string, MappingElement >::const_iterator const_iterator
iterator end()
Returns an iterator in the end of the sequence.
static std::string baseClassVersion()
void setVersion(const std::string &version)
static std::string classId(const std::string &className, const std::string &classVersion)
const std::string & tableName() const
void throwException(const std::string &message, const std::string &methodName)
static std::string newMappingVersionForDependentClass(const std::string &containerName, const std::string &className, int iteration)
static std::string classVersionPropertyNameInDictionary()
static std::string classMappingElementType()
Returns the name of the class mapping element type.
void removeMapping(const std::string &version)
const std::string & scopeName() const
std::string className(const T &t)
void setColumnNames(const std::vector< std::string > &columns)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run