CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Static Public Member Functions | Static Public Attributes | Static Private Member Functions
ora::MappingRules Class Reference

#include <MappingRules.h>

Classes

struct  ToUpper
 

Static Public Member Functions

static std::string baseClassVersion ()
 
static std::string baseIdForClass (const std::string &className)
 
static std::string classId (const std::string &className, const std::string &classVersion)
 
static std::pair< bool,
std::string > 
classNameFromBaseId (const std::string &classId)
 
static std::string classVersionFromId (const std::string &classId)
 
static std::string classVersionPropertyNameInDictionary ()
 
static std::string columnNameForBlobMetadata (const std::string &dataColumnName)
 
static std::string columnNameForId ()
 
static std::string columnNameForNamedReference (const std::string &variableName, const std::string &scope)
 
static std::string columnNameForOID (const std::string &variableName, const std::string &scope, unsigned int index)
 
static std::string columnNameForPosition ()
 
static std::string columnNameForRefColumn ()
 
static std::string columnNameForRefId (const std::string &variableName, const std::string &scope)
 
static std::string columnNameForRefMetadata (const std::string &variableName, const std::string &scope)
 
static std::string columnNameForVariable (const std::string &variableName, const std::string &scope, bool forData=true)
 
static std::string defaultClassVersion (const std::string &className)
 
static std::string fkNameForIdentity (const std::string &tableName, int index=0)
 
static std::string formatName (const std::string &variableName, size_t maxLength)
 formatting for variable names to schema object names More...
 
static bool isLooseOnReading (const std::string &persistencyProperty)
 
static bool isLooseOnWriting (const std::string &persistencyProperty)
 
static bool isMappedToBlob (const std::string &mappingProperty)
 
static std::string mappingPropertyNameInDictionary ()
 class related parameters More...
 
static std::string newMappingVersionForContainer (const std::string &containerName, int iteration)
 mapping versions More...
 
static std::string newMappingVersionForDependentClass (const std::string &containerName, const std::string &className, int iteration)
 
static std::string newNameForArraySchemaObject (const std::string &initialName, unsigned int index, size_t maxLength)
 
static std::string newNameForDepSchemaObject (const std::string &initialName, unsigned int index, size_t maxLength)
 
static std::string newNameForSchemaObject (const std::string &initialName, unsigned int index, size_t maxLength, char indexTrailer=0)
 functions for new schema object name generation More...
 
static std::string persistencyPropertyNameInDictionary ()
 
static std::string scopedVariableForSchemaObjects (const std::string &variableName, const std::string &scope)
 
static std::string scopedVariableName (const std::string &variableName, const std::string &scope)
 variable name manipulation More...
 
static std::string sequenceNameForContainer (const std::string &containerName)
 
static std::string sequenceNameForContainerId ()
 sequence names More...
 
static std::string sequenceNameForDependentClass (const std::string &containerName, const std::string &className)
 
static std::string sequenceNameForMapping ()
 
static std::string tableNameForItem (const std::string &itemName)
 schema object naming More...
 
static std::string variableNameForArrayColumn (unsigned int arrayIndex)
 
static std::string variableNameForArrayColumn (const edm::TypeWithDict &array)
 
static std::string variableNameForArrayIndex (const std::string &arrayVariable, unsigned int index)
 
static std::string variableNameForContainerKey ()
 
static std::string variableNameForContainerValue ()
 

Static Public Attributes

static const size_t ClassNameLengthForSchema = 7
 size parameters for table creation More...
 
static const size_t MaxColumnNameLength = 30
 
static const size_t MaxColumnsForInlineCArray = 13
 
static const size_t MaxColumnsPerTable = 100
 
static const size_t MaxTableNameLength = 20
 

Static Private Member Functions

static std::string nameForSchema (const std::string &variableName)
 
static std::string nameFromTemplate (const std::string &templateClassName, size_t maxLength)
 
static std::string newMappingVersion (const std::string &itemName, int iteration, char versionTrailer)
 
static std::string shortNameByUpperCase (const std::string &className, size_t maxLength)
 
static std::string shortScopedName (const std::string &scopedClassName, size_t maxLength)
 

Detailed Description

Definition at line 15 of file MappingRules.h.

Member Function Documentation

std::string ora::MappingRules::baseClassVersion ( )
static

Definition at line 84 of file MappingRules.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ora::MappingDatabase::insertClassVersion().

85 {
86  static const std::string classVersion("BASE");
87  return classVersion;
88 }
std::string ora::MappingRules::baseIdForClass ( const std::string &  className)
static

Definition at line 79 of file MappingRules.cc.

Referenced by ora::MappingDatabase::getBaseMappingForContainer(), and ora::MappingDatabase::insertClassVersion().

79  {
80  return className+"."+baseClassVersion();
81 }
static std::string baseClassVersion()
Definition: MappingRules.cc:84
std::string className(const T &t)
Definition: ClassName.h:30
std::string ora::MappingRules::classId ( const std::string &  className,
const std::string &  classVersion 
)
static

Definition at line 64 of file MappingRules.cc.

Referenced by ora::MappingDatabase::getMappingForContainer(), ora::MappingDatabase::insertClassVersion(), and ora::MappingDatabase::setMappingVersionForClass().

65  {
66  return className+".V"+classVersion;
67 }
std::string className(const T &t)
Definition: ClassName.h:30
std::pair< bool, std::string > ora::MappingRules::classNameFromBaseId ( const std::string &  classId)
static

Definition at line 90 of file MappingRules.cc.

References GOODCOLL_filter_cfg::cut, and run_regression::ret.

Referenced by ora::PoolMappingSchema::selectMappingVersion().

90  {
91  std::pair<bool,std::string> ret(false,"");
92  size_t cut = classId.find("."+baseClassVersion() );
93  if( cut != std::string::npos ){
94  ret.first = true;
95  ret.second = classId.substr(0,cut);
96  }
97  return ret;
98 }
static std::string baseClassVersion()
Definition: MappingRules.cc:84
static std::string classId(const std::string &className, const std::string &classVersion)
Definition: MappingRules.cc:64
std::string ora::MappingRules::classVersionFromId ( const std::string &  classId)
static

Definition at line 69 of file MappingRules.cc.

References customizeTrackingMonitorSeedNumber::idx, run_regression::ret, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ora::PoolMappingSchema::selectMappingVersion(), and ora::PoolMappingSchema::setMappingVersion().

69  {
70  std::string ret("");
71  size_t idx = classId.find('.');
72  if( idx != std::string::npos ){
73  ret = classId.substr( idx+2 );
74  }
75  return ret;
76 }
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
static std::string classId(const std::string &className, const std::string &classVersion)
Definition: MappingRules.cc:64
std::string ora::MappingRules::classVersionPropertyNameInDictionary ( )
static

Definition at line 109 of file MappingRules.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ora::MappingDatabase::versionOfClass().

110 {
111  static const std::string s_propertyName("class_version");
112  return s_propertyName;
113 
114 }
std::string ora::MappingRules::columnNameForBlobMetadata ( const std::string &  dataColumnName)
static

Definition at line 512 of file MappingRules.cc.

References prof2calltree::prefix, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ora::processLeafElement().

512  {
513  std::string prefix("M");
514  return prefix + dataColumnName.substr(1);
515 }
std::string ora::MappingRules::columnNameForId ( )
static
std::string ora::MappingRules::columnNameForNamedReference ( const std::string &  variableName,
const std::string &  scope 
)
static

Definition at line 479 of file MappingRules.cc.

References run_regression::ret.

Referenced by ora::NamedRefMapping::process().

481 {
482  std::stringstream ret;
483  ret << "R" << columnNameForVariable( variableName, scope, false )<<"_NAME";
484  return ret.str();
485 }
static std::string columnNameForVariable(const std::string &variableName, const std::string &scope, bool forData=true)
std::string ora::MappingRules::columnNameForOID ( const std::string &  variableName,
const std::string &  scope,
unsigned int  index 
)
static

Definition at line 469 of file MappingRules.cc.

References cmsHarvester::index, and run_regression::ret.

Referenced by ora::OraReferenceMapping::process().

472 {
473  std::stringstream ret;
474  ret << "R" << columnNameForVariable( variableName, scope, false )<<"_OID"<<index;
475  return ret.str();
476 }
static std::string columnNameForVariable(const std::string &variableName, const std::string &scope, bool forData=true)
std::string ora::MappingRules::columnNameForPosition ( )
static
std::string ora::MappingRules::columnNameForRefColumn ( )
static
std::string ora::MappingRules::columnNameForRefId ( const std::string &  variableName,
const std::string &  scope 
)
static

Definition at line 497 of file MappingRules.cc.

References run_regression::ret.

Referenced by ora::UniqueReferenceMapping::process().

499 {
500  std::stringstream ret;
501  ret << "RID_" << columnNameForVariable( variableName, scope, false );
502  return ret.str();
503 }
static std::string columnNameForVariable(const std::string &variableName, const std::string &scope, bool forData=true)
std::string ora::MappingRules::columnNameForRefMetadata ( const std::string &  variableName,
const std::string &  scope 
)
static

Definition at line 488 of file MappingRules.cc.

References run_regression::ret.

Referenced by ora::UniqueReferenceMapping::process().

490 {
491  std::stringstream ret;
492  ret << "M" << columnNameForVariable( variableName, scope, false );
493  return ret.str();
494 }
static std::string columnNameForVariable(const std::string &variableName, const std::string &scope, bool forData=true)
std::string ora::MappingRules::columnNameForVariable ( const std::string &  variableName,
const std::string &  scope,
bool  forData = true 
)
static

Definition at line 421 of file MappingRules.cc.

References personalPlayback::fp, run_regression::ret, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ora::processLeafElement().

424 {
425  std::ostringstream totalString;
426  int scopeMaxSize = MaxColumnNameLength/4-1;
427  int extraSize = MaxColumnNameLength-variableName.size()-2;
428  if( extraSize>0 && extraSize>scopeMaxSize ) scopeMaxSize = extraSize;
429  if( !scopeName.empty() ) {
430  size_t scopeCut = scopeName.size();
431  if( scopeCut> (size_t)scopeMaxSize ) scopeCut = scopeMaxSize;
432  totalString << scopeName.substr(0,scopeCut);
433  totalString << "_";
434  }
435  size_t varMaxSize = MaxColumnNameLength-totalString.str().size();
436 
437  size_t fp = variableName.find('[');
438  if( fp != std::string::npos ){
439  // process for c-arrays
440  std::string arrayVar = variableName.substr(0,fp);
441  std::string indexVar = variableName.substr(fp);
442  for( size_t ind = 0; ind!=std::string::npos; ind=indexVar.find('[',ind+1 ) ){
443  indexVar = indexVar.replace(ind,1,"I");
444  }
445  for( size_t ind = indexVar.find(']'); ind!=std::string::npos; ind=indexVar.find(']',ind+1 ) ){
446  indexVar = indexVar.replace(ind,1,"_");
447  }
448  size_t arrayVarCut = 0;
449  size_t varCut = variableName.size()+1;
450  if( varCut>varMaxSize ) varCut = varMaxSize;
451  if( varCut>(indexVar.size()+1) ) arrayVarCut = varCut-indexVar.size()-1;
452  totalString << arrayVar.substr(0,arrayVarCut);
453  totalString << "_" << indexVar;
454  } else {
455  size_t varCut = variableName.size();
456  if( varCut>varMaxSize ) varCut = varMaxSize;
457  // other types
458  totalString << variableName.substr(0,varCut);
459  }
460 
461  std::stringstream ret;
462  if(forData) ret << "D";
463  ret << nameForSchema(totalString.str());
464  //return formatForSchema(ret.str(),MaxColumnNameLength);
465  return formatName(ret.str(),MaxColumnNameLength);
466 }
static std::string nameForSchema(const std::string &variableName)
static const size_t MaxColumnNameLength
Definition: MappingRules.h:20
static std::string formatName(const std::string &variableName, size_t maxLength)
formatting for variable names to schema object names
std::string ora::MappingRules::defaultClassVersion ( const std::string &  className)
static

Definition at line 101 of file MappingRules.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ora::MappingDatabase::versionOfClass().

102 {
103  std::string classVersion(className);
104  classVersion.append("_default");
105  return classVersion;
106 }
std::string className(const T &t)
Definition: ClassName.h:30
std::string ora::MappingRules::fkNameForIdentity ( const std::string &  tableName,
int  index = 0 
)
static

Definition at line 518 of file MappingRules.cc.

References cmsHarvester::index, and run_regression::ret.

Referenced by ora::MappingToSchema::createTable().

519 {
520  std::stringstream ret;
521  ret << tableName <<"_ID_FK";
522  if( index ) ret << "_"<<index;
523  return ret.str();
524 }
std::string ora::MappingRules::formatName ( const std::string &  variableName,
size_t  maxLength 
)
static

formatting for variable names to schema object names

Definition at line 526 of file MappingRules.cc.

Referenced by ora::MappingGenerator::createNewDependentMapping(), and ora::MappingGenerator::createNewMapping().

527  {
528  return nameFromTemplate( variableName, maxLength );
529 }
static std::string nameFromTemplate(const std::string &templateClassName, size_t maxLength)
bool ora::MappingRules::isLooseOnReading ( const std::string &  persistencyProperty)
static

Definition at line 54 of file MappingRules.cc.

Referenced by ora::isLoosePersistencyDataMember().

54  {
55  return (persistencyProperty == "loose_on_reading" || persistencyProperty == "LOOSE_ON_READING" );
56 }
bool ora::MappingRules::isLooseOnWriting ( const std::string &  persistencyProperty)
static

Definition at line 59 of file MappingRules.cc.

Referenced by ora::isLoosePersistencyDataMember(), and ora::isLoosePersistencyOnWriting().

59  {
60  return (persistencyProperty == "loose_on_writing" || persistencyProperty == "LOOSE_ON_WRITING" );
61 }
bool ora::MappingRules::isMappedToBlob ( const std::string &  mappingProperty)
static

Definition at line 43 of file MappingRules.cc.

Referenced by ora::isMappedToBlob().

43  {
44  return (mappingProperty == "Blob" || mappingProperty == "blob" || mappingProperty == "BLOB" );
45 }
std::string ora::MappingRules::mappingPropertyNameInDictionary ( )
static

class related parameters

Definition at line 36 of file MappingRules.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ora::isMappedToBlob().

37 {
38  static const std::string s_propertyName("mapping");
39  return s_propertyName;
40 }
std::string ora::MappingRules::nameForSchema ( const std::string &  variableName)
staticprivate

Definition at line 252 of file MappingRules.cc.

References dqm_diff::start, AlCaHLTBitMon_QueryRunRegistry::string, create_public_lumi_plots::transform, and up.

252  {
253  std::string varName( variableName );
254  //first turn className into uppercase
255  MappingRules::ToUpper up(std::locale::classic());
256  std::transform(varName.begin(), varName.end(),varName.begin(),up);
257  size_t cutPoint = varName.size();
258  if(cutPoint && varName[varName.size()-1] == '_' ) cutPoint -= 1;
259  if(!cutPoint) return "";
260  size_t start = 0;
261  if(varName.size() && varName[0]== '_' ) start = 1;
262  return varName.substr(start,cutPoint);
263 }
Definition: BitonicSort.h:8
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
std::string ora::MappingRules::nameFromTemplate ( const std::string &  templateClassName,
size_t  maxLength 
)
staticprivate

Definition at line 362 of file MappingRules.cc.

References i, prof2calltree::prefix, and AlCaHLTBitMon_QueryRunRegistry::string.

363  {
364  if( !maxLength ) return "";
365  std::string tempClassName(templateClassName);
366  size_t indComas = tempClassName.find(',',0);
367  std::vector<size_t> vComas;
368  while(indComas != std::string::npos) {
369  vComas.push_back(indComas);
370  indComas = tempClassName.find(',',indComas+1);
371  }
372  typedef std::vector<size_t>::const_iterator vSizeIter;
373  vSizeIter vBegin = vComas.begin();
374  vSizeIter vEnd = vComas.end();
375  for(vSizeIter i = vBegin; i != vEnd; ++i) {
376  tempClassName.replace(*i, 1, 1, '_');
377  }
378  std::string newName("");
379  size_t ind0 = tempClassName.find('<',0);
380  if( ind0 != std::string::npos ){
381  size_t ind1 = tempClassName.rfind('>');
382  std::string templArg = tempClassName.substr( ind0+1, ind1-ind0-1 );
383  std::string prefix = shortScopedName( tempClassName.substr( 0, ind0 ), maxLength );
384  size_t currSize = templArg.size()+prefix.size()+1;
385  if( currSize > maxLength+1 ){
386  // a cut is required...
387  size_t prefixL = maxLength/3;
388  if( prefixL == 0 ) prefixL = 1;
389  if( prefixL >1 ) prefixL -=1;
390  prefix = shortScopedName( prefix, prefixL );
391  }
392  size_t templMaxSize = maxLength-prefix.size()-1;
393  templArg = nameFromTemplate( templArg, templMaxSize );
394  newName = prefix+"_"+ templArg;
395  } else {
396  newName = shortScopedName( tempClassName, maxLength );
397  }
398  //checkString( newName, 3 );
399  return newName;
400 }
int i
Definition: DBlmapReader.cc:9
static std::string shortScopedName(const std::string &scopedClassName, size_t maxLength)
static std::string nameFromTemplate(const std::string &templateClassName, size_t maxLength)
std::string ora::MappingRules::newMappingVersion ( const std::string &  itemName,
int  iteration,
char  versionTrailer 
)
staticprivate

Definition at line 117 of file MappingRules.cc.

References align_cfg::iteration.

119  {
120  std::ostringstream os;
121  os << itemName;
122  os << "_" << versionTrailer;
123  if ( iteration > 0 ) {
124  if ( iteration < 10 ) os << "0";
125  if ( iteration < 100 ) os << "0";
126  os << iteration;
127  } else {
128  os << "000";
129  }
130  return os.str();
131 }
tuple iteration
Definition: align_cfg.py:5
std::string ora::MappingRules::newMappingVersionForContainer ( const std::string &  containerName,
int  iteration 
)
static

mapping versions

Definition at line 134 of file MappingRules.cc.

Referenced by ora::MappingDatabase::newMappingVersionForContainer().

135  {
136  return newMappingVersion( containerName, iteration, 'M' );
137 }
tuple iteration
Definition: align_cfg.py:5
static std::string newMappingVersion(const std::string &itemName, int iteration, char versionTrailer)
std::string ora::MappingRules::newMappingVersionForDependentClass ( const std::string &  containerName,
const std::string &  className,
int  iteration 
)
static

Definition at line 140 of file MappingRules.cc.

References className(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ora::MappingDatabase::newMappingVersionForDependentClass().

143 {
144  std::string contDependencyName = containerName+"_"+className;
145  return newMappingVersion( contDependencyName, iteration, 'D' );
146 }
tuple iteration
Definition: align_cfg.py:5
static std::string newMappingVersion(const std::string &itemName, int iteration, char versionTrailer)
std::string className(const T &t)
Definition: ClassName.h:30
std::string ora::MappingRules::newNameForArraySchemaObject ( const std::string &  initialName,
unsigned int  index,
size_t  maxLength 
)
static

Definition at line 244 of file MappingRules.cc.

Referenced by ora::ArrayMapping::process(), and ora::CArrayMapping::process().

247 {
248  return newNameForSchemaObject( initialName, index, maxL, 'A' );
249 }
static std::string newNameForSchemaObject(const std::string &initialName, unsigned int index, size_t maxLength, char indexTrailer=0)
functions for new schema object name generation
std::string ora::MappingRules::newNameForDepSchemaObject ( const std::string &  initialName,
unsigned int  index,
size_t  maxLength 
)
static

Definition at line 236 of file MappingRules.cc.

Referenced by ora::MappingGenerator::createNewDependentMapping().

239 {
240  return newNameForSchemaObject( initialName, index, maxLength, 'D' );
241 }
static std::string newNameForSchemaObject(const std::string &initialName, unsigned int index, size_t maxLength, char indexTrailer=0)
functions for new schema object name generation
std::string ora::MappingRules::newNameForSchemaObject ( const std::string &  initialName,
unsigned int  index,
size_t  maxLength,
char  indexTrailer = 0 
)
static

functions for new schema object name generation

Definition at line 216 of file MappingRules.cc.

References cmsHarvester::index, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ora::OraReferenceMapping::process(), ora::UniqueReferenceMapping::process(), ora::NamedRefMapping::process(), and ora::processLeafElement().

219  {
220  unsigned int digitsForPostfix = 3;
221  if(index<10) digitsForPostfix = 2;
222  size_t newSize = initialName.size()+digitsForPostfix;
223  if(newSize > maxLength) newSize = maxLength;
224  unsigned int cutSize = newSize - digitsForPostfix;
225  std::stringstream newStr("");
226  if( initialName[cutSize-1]=='_' ) cutSize -= 1;
227  std::string cutString = initialName.substr(0, cutSize );
228  newStr << cutString << "_";
229  if( indexTrailer !=0 ) newStr<< indexTrailer;
230  newStr<< index;
231  //checkString( newStr.str(), 7 );
232  return newStr.str();
233 }
std::string ora::MappingRules::persistencyPropertyNameInDictionary ( )
static

Definition at line 48 of file MappingRules.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ora::isLoosePersistencyDataMember(), and ora::isLoosePersistencyOnWriting().

48  {
49  static const std::string s_propertyName("persistency");
50  return s_propertyName;
51 }
std::string ora::MappingRules::scopedVariableForSchemaObjects ( const std::string &  variableName,
const std::string &  scope 
)
static

Definition at line 191 of file MappingRules.cc.

Referenced by ora::processBaseClasses().

192  {
193  std::stringstream scopedName;
194  if(!scope.empty()) scopedName << formatName(scope, ClassNameLengthForSchema) << "_";
195  scopedName << variableName;
196  return scopedName.str();
197 }
static const size_t ClassNameLengthForSchema
size parameters for table creation
Definition: MappingRules.h:18
static std::string formatName(const std::string &variableName, size_t maxLength)
formatting for variable names to schema object names
std::string ora::MappingRules::scopedVariableName ( const std::string &  variableName,
const std::string &  scope 
)
static

variable name manipulation

Definition at line 149 of file MappingRules.cc.

Referenced by ora::ObjectStreamerBase::buildBaseDataMembers(), ora::ObjectStreamerBase::buildDataMembers(), and ora::processBaseClasses().

150  {
151  std::stringstream scopedName;
152  if(!scope.empty()) scopedName << scope << "::";
153  scopedName << variableName;
154  return scopedName.str();
155 }
std::string ora::MappingRules::sequenceNameForContainer ( const std::string &  containerName)
static
std::string ora::MappingRules::sequenceNameForContainerId ( )
static

sequence names

Definition at line 10 of file MappingRules.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ora::PoolDbCache::add(), ora::PoolDbCache::clear(), and ora::DatabaseSession::startTransaction().

10  {
11  static const std::string s_sequenceName("CONTAINER_ID");
12  return s_sequenceName;
13 }
std::string ora::MappingRules::sequenceNameForDependentClass ( const std::string &  containerName,
const std::string &  className 
)
static
std::string ora::MappingRules::sequenceNameForMapping ( )
static

Definition at line 30 of file MappingRules.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ora::PoolDbCache::clear().

30  {
31  static const std::string s_mappingSequenceName("MAPPING_ELEMENT_ID");
32  return s_mappingSequenceName;
33 }
std::string ora::MappingRules::shortNameByUpperCase ( const std::string &  className,
size_t  maxLength 
)
staticprivate

Definition at line 265 of file MappingRules.cc.

References GOODCOLL_filter_cfg::cut, i, j, bookConverter::max, and dqm_diff::start.

266  {
267  if( !maxL ) return "";
268  if( className.size() < maxL ) return className;
269  std::vector< size_t> uppers;
270  for( size_t i=0;i<className.size();i++) {
271  if(::isupper(className[i]) || ::isdigit(className[i]) ) uppers.push_back(i);
272  }
273  std::stringstream shName;
274  size_t usize = uppers.size();
275  if( usize < maxL ){
276  size_t start = 0;
277  size_t cut = maxL-usize;
278  if( usize && (cut > uppers[0]) ) cut = uppers[0];
279  shName << className.substr( start, cut );
280  size_t left = maxL-cut-usize;
281  if( usize > 1) left = 0;
282  size_t curs = 0;
283  for( size_t i=0; i<usize;i++){
284  size_t st = uppers[i];
285  curs = st+left+1;
286  shName << className.substr(st,left+1);
287  left = 0;
288  }
289  size_t maxIndex = className.size();
290  if( shName.str().size()<maxL && curs < maxIndex ){
291  size_t more = maxL - shName.str().size();
292  size_t max = curs+more;
293  if(max > className.size()) max = className.size();
294  for( size_t j=curs;j<max-1;j++ ){
295  shName << className[j];
296  }
297  }
298 
299  //checkString( shName.str(), 0 );
300  } else {
301  shName << className[0];
302  for(size_t i=0 ;i<maxL-1;i++) {
303  if( uppers[i] != 0 ) shName << className[uppers[i]];
304  }
305  //checkString( shName.str(), 1 );
306  }
308  return shName.str();
309 }
int i
Definition: DBlmapReader.cc:9
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
int j
Definition: DBlmapReader.cc:9
std::string className(const T &t)
Definition: ClassName.h:30
std::string ora::MappingRules::shortScopedName ( const std::string &  scopedClassName,
size_t  maxLength 
)
staticprivate

Definition at line 311 of file MappingRules.cc.

References run_regression::ret, and AlCaHLTBitMon_QueryRunRegistry::string.

312  {
313  if( !maxLength ) return "";
314  std::string cn = scopedClassName;
315  std::string sn("");
316  size_t ns = cn.rfind("::");
317  if( ns!= std::string::npos ){
318  cn = scopedClassName.substr( ns+2 );
319  sn = scopedClassName.substr( 0, ns );
320  }
321  //
322  ns = cn.find(" ");
323  while( ns != std::string::npos ){
324  cn = cn.replace( ns, 1, "_");
325  ns = cn.find(" ");
326  }
327  //
328  ns = sn.find("::");
329  if( ns == 0 ){
330  sn = sn.substr( 2 );
331  ns = sn.find("::");
332  }
333  while( ns != std::string::npos ){
334  sn = sn.replace( ns, 2, "_");
335  ns = sn.find("::");
336  }
337  //
338  if( sn[sn.size()-1]=='_' ) sn = sn.substr(0,sn.size()-1);
339  // ignore if namespace==std
340  if( sn == "std" ) sn = "";
341 
342  size_t currSize = sn.size()+cn.size()+1;
343  if( currSize > maxLength+1 ){
344  // a cut is required...
345  size_t maxScopeLen = maxLength/3;
346  if( maxScopeLen ==0 ) maxScopeLen = 1;
347  if( maxScopeLen > 1 ) maxScopeLen -= 1;
348  if( sn.size() > maxScopeLen ){
349  sn = sn.substr( 0,maxScopeLen );
350  }
351  size_t availableSize = maxLength-sn.size();
352  if( sn.size() ) availableSize -= 1;
353  cn =shortNameByUpperCase( cn, availableSize );
354  }
355  std::string ret = sn;
356  if(!ret.empty()) ret += "_";
357  ret += cn;
358  //checkString( ret, 2 );
359  return ret;
360 }
static std::string shortNameByUpperCase(const std::string &className, size_t maxLength)
std::string ora::MappingRules::tableNameForItem ( const std::string &  itemName)
static

schema object naming

Definition at line 403 of file MappingRules.cc.

Referenced by ora::MappingGenerator::createNewMapping().

404 {
405  return "ORA_C_"+nameForSchema(formatName( itemName, MaxTableNameLength-5 ));
406 }
static std::string nameForSchema(const std::string &variableName)
static const size_t MaxTableNameLength
Definition: MappingRules.h:19
static std::string formatName(const std::string &variableName, size_t maxLength)
formatting for variable names to schema object names
std::string ora::MappingRules::variableNameForArrayColumn ( unsigned int  arrayIndex)
static

Definition at line 166 of file MappingRules.cc.

Referenced by ora::CArrayMapping::process().

166  {
167  std::ostringstream arrayElementLabel;
168  arrayElementLabel << "I" << arrayIndex;
169  return arrayElementLabel.str();
170 }
std::string ora::MappingRules::variableNameForArrayColumn ( const edm::TypeWithDict array)
static

Definition at line 173 of file MappingRules.cc.

References ora::ClassUtils::arrayLength().

173  {
174  std::stringstream contentTypeName;
175  size_t arraySize = ClassUtils::arrayLength( array );
176  contentTypeName << "A" << arraySize;
177  return contentTypeName.str();
178 }
size_t arrayLength(const edm::TypeWithDict &typ)
Definition: ClassUtils.cc:490
std::string ora::MappingRules::variableNameForArrayIndex ( const std::string &  arrayVariable,
unsigned int  index 
)
static

Definition at line 158 of file MappingRules.cc.

Referenced by ora::InlineCArrayStreamerBase::buildDataElement(), and ora::CArrayMapping::process().

159  {
160  std::ostringstream arrayElementLabel;
161  arrayElementLabel << arrayVariable << "[" << index << "]";
162  return arrayElementLabel.str();
163 }
std::string ora::MappingRules::variableNameForContainerKey ( )
static

Definition at line 185 of file MappingRules.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ora::ArrayMapping::process().

185  {
186  static const std::string s_ck("CK");
187  return s_ck;
188 }
std::string ora::MappingRules::variableNameForContainerValue ( )
static

Definition at line 180 of file MappingRules.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ora::ArrayMapping::process().

180  {
181  static const std::string s_cv("CV");
182  return s_cv;
183 }

Member Data Documentation

const size_t ora::MappingRules::ClassNameLengthForSchema = 7
static

size parameters for table creation

Definition at line 18 of file MappingRules.h.

Referenced by ora::MappingGenerator::createNewDependentMapping(), and ora::MappingGenerator::createNewMapping().

const size_t ora::MappingRules::MaxColumnNameLength = 30
static
const size_t ora::MappingRules::MaxColumnsForInlineCArray = 13
static

Definition at line 22 of file MappingRules.h.

Referenced by ora::CArrayMapping::process().

const size_t ora::MappingRules::MaxColumnsPerTable = 100
static
const size_t ora::MappingRules::MaxTableNameLength = 20
static