CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MappingRules.h
Go to the documentation of this file.
1 #ifndef INCLUDE_ORA_MAPPINGRULES_H
2 #define INCLUDE_ORA_MAPPINGRULES_H
3 
4 //
5 #include <string>
6 #include <locale>
7 #include <algorithm>
8 
9 namespace edm {
10  class TypeWithDict;
11 }
12 
13 namespace ora {
14 
15  class MappingRules {
16  public:
18  static const size_t ClassNameLengthForSchema = 7;
19  static const size_t MaxTableNameLength = 20;
20  static const size_t MaxColumnNameLength = 30;
21  static const size_t MaxColumnsPerTable = 100;
22  static const size_t MaxColumnsForInlineCArray = 13;
23 
24  public:
27  static std::string sequenceNameForContainer( const std::string& containerName );
28  static std::string sequenceNameForDependentClass( const std::string& containerName, const std::string& className );
30 
32  static std::string newMappingVersionForContainer( const std::string& containerName, int iteration );
34 
37  static bool isMappedToBlob(const std::string& mappingProperty);
39  static bool isLooseOnReading(const std::string& persistencyProperty );
40  static bool isLooseOnWriting(const std::string& persistencyProperty );
41  static std::string classId( const std::string& className, const std::string& classVersion );
45  static std::pair<bool,std::string> classNameFromBaseId( const std::string& classId );
48 
50  static std::string scopedVariableName( const std::string& variableName, const std::string& scope );
51  static std::string variableNameForArrayIndex( const std::string& arrayVariable, unsigned int index );
52  static std::string variableNameForArrayColumn( unsigned int arrayIndex );
56  static std::string scopedVariableForSchemaObjects( const std::string& variableName, const std::string& scope );
57 
59  static std::string newNameForSchemaObject( const std::string& initialName, unsigned int index, size_t maxLength, char indexTrailer=0 );
60  static std::string newNameForDepSchemaObject( const std::string& initialName, unsigned int index, size_t maxLength);
61  static std::string newNameForArraySchemaObject( const std::string& initialName, unsigned int index, size_t maxLength);
62 
64  static std::string tableNameForItem( const std::string& itemName );
67  static std::string columnNameForVariable( const std::string& variableName, const std::string& scope, bool forData=true );
68  static std::string columnNameForOID( const std::string& variableName, const std::string& scope, unsigned int index );
69  static std::string columnNameForRefMetadata( const std::string& variableName, const std::string& scope );
70  static std::string columnNameForRefId( const std::string& variableName, const std::string& scope );
72  static std::string columnNameForNamedReference( const std::string& variableName, const std::string& scope );
73  static std::string columnNameForBlobMetadata( const std::string& dataColumnName );
75 
77  static std::string formatName( const std::string& variableName, size_t maxLength );
78 
79  private:
80 
81  struct ToUpper {
82  ToUpper(const std::locale& l):loc(l) {}
83  char operator() (char c) const { return std::toupper(c,loc); }
84  std::locale const& loc;
85  };
86  static std::string nameForSchema( const std::string& variableName );
87  static std::string shortNameByUpperCase( const std::string& className, size_t maxLength );
88  static std::string shortScopedName( const std::string& scopedClassName, size_t maxLength );
89  static std::string nameFromTemplate( const std::string& templateClassName, size_t maxLength );
90 
91  static std::string newMappingVersion( const std::string& itemName, int iteration, char versionTrailer );
92 
93 
98 
100 
106 
113 
120 
122 
127  };
128 }
129 
130 #endif
131 
static std::string columnNameForRefId(const std::string &variableName, const std::string &scope)
static std::string variableNameForArrayIndex(const std::string &arrayVariable, unsigned int index)
static std::string scopedVariableName(const std::string &variableName, const std::string &scope)
variable name manipulation
static std::string newMappingVersionForContainer(const std::string &containerName, int iteration)
mapping versions
static std::string variableNameForContainerKey()
static std::string variableNameForArrayColumn(unsigned int arrayIndex)
static std::string variableNameForContainerValue()
static std::string persistencyPropertyNameInDictionary()
Definition: MappingRules.cc:48
static std::string newNameForDepSchemaObject(const std::string &initialName, unsigned int index, size_t maxLength)
static const size_t MaxColumnsForInlineCArray
Definition: MappingRules.h:22
static std::string baseIdForClass(const std::string &className)
Definition: MappingRules.cc:79
static std::string scopedVariableForSchemaObjects(const std::string &variableName, const std::string &scope)
static std::string shortScopedName(const std::string &scopedClassName, size_t maxLength)
static std::string columnNameForRefColumn()
static std::string columnNameForVariable(const std::string &variableName, const std::string &scope, bool forData=true)
char operator()(char c) const
Definition: MappingRules.h:83
static std::string mappingPropertyNameInDictionary()
class related parameters
Definition: MappingRules.cc:36
ToUpper(const std::locale &l)
Definition: MappingRules.h:82
static std::string columnNameForPosition()
tuple iteration
Definition: align_cfg.py:5
static std::string shortNameByUpperCase(const std::string &className, size_t maxLength)
static std::string sequenceNameForMapping()
Definition: MappingRules.cc:30
static std::string defaultClassVersion(const std::string &className)
static std::string newMappingVersion(const std::string &itemName, int iteration, char versionTrailer)
static std::string columnNameForOID(const std::string &variableName, const std::string &scope, unsigned int index)
static bool isLooseOnReading(const std::string &persistencyProperty)
Definition: MappingRules.cc:54
static std::string columnNameForBlobMetadata(const std::string &dataColumnName)
static std::string newNameForArraySchemaObject(const std::string &initialName, unsigned int index, size_t maxLength)
static bool isMappedToBlob(const std::string &mappingProperty)
Definition: MappingRules.cc:43
static std::string columnNameForId()
static std::string classVersionFromId(const std::string &classId)
Definition: MappingRules.cc:69
static std::pair< bool, std::string > classNameFromBaseId(const std::string &classId)
Definition: MappingRules.cc:90
static bool isLooseOnWriting(const std::string &persistencyProperty)
Definition: MappingRules.cc:59
static std::string columnNameForRefMetadata(const std::string &variableName, const std::string &scope)
std::locale const & loc
Definition: MappingRules.h:84
static const size_t MaxColumnsPerTable
Definition: MappingRules.h:21
static std::string nameFromTemplate(const std::string &templateClassName, size_t maxLength)
static std::string baseClassVersion()
Definition: MappingRules.cc:84
static std::string columnNameForNamedReference(const std::string &variableName, const std::string &scope)
static const size_t ClassNameLengthForSchema
size parameters for table creation
Definition: MappingRules.h:18
static std::string nameForSchema(const std::string &variableName)
static std::string classId(const std::string &className, const std::string &classVersion)
Definition: MappingRules.cc:64
static std::string sequenceNameForContainer(const std::string &containerName)
Definition: MappingRules.cc:15
static std::string tableNameForItem(const std::string &itemName)
schema object naming
static const size_t MaxColumnNameLength
Definition: MappingRules.h:20
static std::string sequenceNameForContainerId()
sequence names
Definition: MappingRules.cc:10
static std::string newMappingVersionForDependentClass(const std::string &containerName, const std::string &className, int iteration)
static std::string sequenceNameForDependentClass(const std::string &containerName, const std::string &className)
Definition: MappingRules.cc:21
static std::string classVersionPropertyNameInDictionary()
static const size_t MaxTableNameLength
Definition: MappingRules.h:19
static std::string newNameForSchemaObject(const std::string &initialName, unsigned int index, size_t maxLength, char indexTrailer=0)
functions for new schema object name generation
static std::string formatName(const std::string &variableName, size_t maxLength)
formatting for variable names to schema object names
static std::string fkNameForIdentity(const std::string &tableName, int index=0)
std::string className(const T &t)
Definition: ClassName.h:30