23 std::map<std::string,std::vector<MappingRawElement> >::iterator iScope = innerElements.find(scopeName);
24 if(iScope != innerElements.end()){
25 for( std::vector<MappingRawElement>::const_iterator iM = iScope->second.begin();
26 iM != iScope->second.end(); ++iM ){
33 nextScope.append(
"::").append(iM->variableName);
34 buildElement( element, nextScope, innerElements );
37 innerElements.erase(scopeName);
41 int newElemId = m_mappingSequence.getNextId();
51 iSubEl != element.
end(); ++iSubEl) {
52 unfoldElement( iSubEl->second, destination );
58 m_mappingSequence(
MappingRules::sequenceNameForMapping(), schema ),
68 m_mappingSequence.create();
74 m_schema.mappingSchema().getVersionList( m_versions );
82 for ( std::set<std::string>::reverse_iterator iVersion = m_versions.rbegin();
83 iVersion != m_versions.rend(); ++iVersion ) {
84 if ( *iVersion == newMappingVersion ) {
90 m_versions.insert( newMappingVersion );
95 return newMappingVersion;
101 m_schema.mappingSchema().getVersionList( m_versions );
109 for ( std::set<std::string>::reverse_iterator iVersion = m_versions.rbegin();
110 iVersion != m_versions.rend(); ++iVersion ) {
111 if ( *iVersion == newMappingVersion ) {
117 m_versions.insert( newMappingVersion );
122 return newMappingVersion;
128 if(m_schema.mappingSchema().getMapping( version, mapData )){
131 bool topLevelFound =
false;
132 bool dependency =
false;
133 std::map<std::string, std::vector<MappingRawElement> > innerElements;
134 for( std::map< int, MappingRawElement>::iterator iElem = mapData.
elements.begin();
135 iElem != mapData.
elements.end(); iElem++ ){
141 throwException(
"Mapping inconsistent.More then one top level element found.",
142 "MappingDatabase::getMappingByVersion");
144 topLevelElement = iElem->second;
146 topLevelFound =
true;
149 std::map<std::string, std::vector<MappingRawElement> >::iterator iN = innerElements.find( iElem->second.scopeName );
150 if(iN==innerElements.end()){
151 innerElements.insert( std::make_pair( iElem->second.scopeName, std::vector<MappingRawElement>(1,iElem->second) ) );
153 iN->second.push_back( iElem->second );
157 if( !topLevelFound ){
158 throwException(
"Could not find top element for mapping version \""+version+
"\".",
159 "MappingDatabase::getMappingByVersion" );
165 buildElement( topElement, topLevelElement.
variableName, innerElements );
172 m_schema.mappingSchema().removeMapping( version );
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");
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 );
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 );
273 std::string classVersion = versionOfClass( dictionaryEntry );
274 insertClassVersion( className, classVersion, depIndex, containerId, mappingVersion, asBase );
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 );
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)
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
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.
std::string cppName() const
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)
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()
void insertClassVersion(const edm::TypeWithDict &dictionaryEntry, int dependencyIndex, int containerId, const std::string &mappingVersion, bool asBase=false)
const std::string & variableType() const
std::map< std::string, MappingElement >::const_iterator const_iterator
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
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)
std::string getClassProperty(const std::string &propertyName, const edm::TypeWithDict &type)
static std::string versionOfClass(const edm::TypeWithDict &dictionary)
const std::string & tableName() const
static std::string newMappingVersionForDependentClass(const std::string &containerName, const std::string &className, int iteration)
volatile std::atomic< bool > shutdown_flag false
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
void setMappingVersionForClass(const edm::TypeWithDict &dictionaryEntry, int containerId, const std::string &mappingVersion, bool dependency=false)