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 ),
72 m_schema.mappingSchema().getVersionList( m_versions );
76 std::string newMappingVersion =
"";
80 for ( std::set<std::string>::reverse_iterator iVersion = m_versions.rbegin();
81 iVersion != m_versions.rend(); ++iVersion ) {
82 if ( *iVersion == newMappingVersion ) {
88 m_versions.insert( newMappingVersion );
93 return newMappingVersion;
99 m_schema.mappingSchema().getVersionList( m_versions );
103 std::string newMappingVersion =
"";
107 for ( std::set<std::string>::reverse_iterator iVersion = m_versions.rbegin();
108 iVersion != m_versions.rend(); ++iVersion ) {
109 if ( *iVersion == newMappingVersion ) {
115 m_versions.insert( newMappingVersion );
120 return newMappingVersion;
126 if(m_schema.mappingSchema().getMapping( version, mapData )){
129 bool topLevelFound =
false;
130 bool dependency =
false;
131 std::map<std::string, std::vector<MappingRawElement> > innerElements;
132 for( std::map< int, MappingRawElement>::iterator iElem = mapData.
elements.begin();
133 iElem != mapData.
elements.end(); iElem++ ){
139 throwException(
"Mapping inconsistent.More then one top level element found.",
140 "MappingDatabase::getMappingByVersion");
142 topLevelElement = iElem->second;
144 topLevelFound =
true;
147 std::map<std::string, std::vector<MappingRawElement> >::iterator iN = innerElements.find( iElem->second.scopeName );
148 if(iN==innerElements.end()){
149 innerElements.insert( std::make_pair( iElem->second.scopeName, std::vector<MappingRawElement>(1,iElem->second) ) );
151 iN->second.push_back( iElem->second );
155 if( !topLevelFound ){
156 throwException(
"Could not find top element for mapping version \""+version+
"\".",
157 "MappingDatabase::getMappingByVersion" );
163 buildElement( topElement, topLevelElement.
variableName, innerElements );
170 m_schema.mappingSchema().removeMapping( version );
180 std::string
className = containerClass.Name(Reflex::SCOPED);
181 std::string classVersion = versionOfClass( containerClass );
185 bool found = m_schema.mappingSchema().selectMappingVersion( classId, containerId, version );
188 ret = getMappingByVersion( version, destination );
191 "MappingDatabase::getMappingForContainer");
194 throwException(
"Mapping inconsistency detected for version=\""+version+
"\"",
195 "MappingDatabase::getMappingForContainer");
206 std::string mappingVersion(
"");
207 bool found = m_schema.mappingSchema().selectMappingVersion( classId, containerId, mappingVersion );
210 ret = getMappingByVersion( mappingVersion, destination );
212 throwException(
"Mapping version \""+mappingVersion+
"\" not found.",
213 "MappingDatabase::getBaseMappingForContainer");
216 throwException(
"Mapping inconsistency detected for version=\""+mappingVersion+
"\"",
217 "MappingDatabase::getBaseMappingForContainer");
224 std::vector<MappingElement>& destination ){
226 std::set<std::string> versions;
227 if( m_schema.mappingSchema().getMappingVersionListForContainer( containerId, versions,
true ) ){
229 for( std::set<std::string>::iterator iM = versions.begin();
230 iM != versions.end(); ++iM ){
232 if( ! getMappingByVersion( *iM, mapping )){
234 "MappingDatabase::getDependentMappingsForContainer");
237 destination.push_back( mapping.
topElement() );
244 std::set<std::string>& destination ){
245 return m_schema.mappingSchema().getClassVersionListForMappingVersion( mappingVersion, destination );
249 const std::string& classVersion,
252 const std::string& mappingVersion,
255 m_schema.mappingSchema().insertClassVersion( className, classVersion, classId, dependencyIndex, containerId, mappingVersion );
262 std::map<std::string,std::string>& versionMap ){
264 return m_schema.mappingSchema().getClassVersionListForContainer( containerId, versionMap );
270 const std::string& mappingVersion,
272 std::string
className = dictionaryEntry.Name( Reflex::SCOPED );
273 std::string classVersion = versionOfClass( dictionaryEntry );
274 insertClassVersion( className, classVersion, depIndex, containerId, mappingVersion, asBase );
279 const std::string& mappingVersion,
281 std::string
className = dictionaryEntry.Name( Reflex::SCOPED );
282 std::string classVersion = versionOfClass( dictionaryEntry );
285 bool found = m_schema.mappingSchema().selectMappingVersion( classId, containerId, mv );
288 if( dependency ) depIndex = 1;
289 m_schema.mappingSchema().insertClassVersion( className, classVersion, classId, depIndex, containerId, mappingVersion );
291 m_schema.mappingSchema().setMappingVersion( classId, containerId, mappingVersion );
297 unfoldElement( mapping.
topElement(), rowMapping );
298 m_mappingSequence.sinchronize();
299 m_schema.mappingSchema().storeMapping( rowMapping );
303 return m_schema.mappingSchema().getMappingVersionListForContainer( containerId, versionList );
308 m_schema.mappingSchema().getVersionList( m_versions );
315 std::set<std::string>&
list ){
316 return m_schema.mappingSchema().getDependentClassesInContainerMapping( containerId, list );
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)
bool getMappingForContainer(const Reflex::Type &containerClass, int containerId, MappingTree &destination)
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