CMS 3D CMS Logo

Functions

ora::RelationalMapping Namespace Reference

Functions

void _sizeInColumns (const Reflex::Type &typ, size_t &sz, bool &hasDependencies)
void _sizeInColumnsForCArray (const Reflex::Type &typ, size_t &sz, bool &hasDependencies)
size_t sizeInColumns (const Reflex::Type &topLevelClassType)
std::pair< bool, size_t > sizeInColumnsForCArray (const Reflex::Type &arrayType)

Function Documentation

void ora::RelationalMapping::_sizeInColumns ( const Reflex::Type &  typ,
size_t &  sz,
bool &  hasDependencies 
)

Definition at line 31 of file RelationalMapping.cc.

References _sizeInColumnsForCArray(), i, ora::ClassUtils::isTypeAssociativeContainer(), ora::ClassUtils::isTypeNamedReference(), ora::ClassUtils::isTypeNonAssociativeContainer(), ora::ClassUtils::isTypeOraPointer(), ora::ClassUtils::isTypePrimitive(), ora::ClassUtils::isTypeUniqueReference(), and ora::ClassUtils::resolvedType().

Referenced by _sizeInColumnsForCArray(), and sizeInColumns().

                                                              {
  // resolve possible typedef chains
  Reflex::Type typ = ClassUtils::resolvedType( topLevelClassType );
  bool isOraPolyPointer = ora::ClassUtils::isTypeUniqueReference(typ);
  bool isPrimitive = ora::ClassUtils::isTypePrimitive( typ );

  // primitive and string
  if( isPrimitive || isOraPolyPointer || ora::ClassUtils::isTypeNamedReference( typ)) {
    ++sz;
  } else if (typ.IsArray()){
    size_t arraySize = 0;
    _sizeInColumnsForCArray( typ,arraySize, hasDependencies );
    if( arraySize < MappingRules::MaxColumnsForInlineCArray ) sz += arraySize;
    else hasDependencies = true;
  } else if (typ.TypeInfo() == typeid(ora::Reference) ||
             typ.HasBase( Reflex::Type::ByTypeInfo( typeid(ora::Reference) ) )){
    sz += 2;
  } else {
  
    bool isContainer =  ora::ClassUtils::isTypeNonAssociativeContainer(typ) ||
      ora::ClassUtils::isTypeAssociativeContainer(typ);
    bool isOraPointer = ora::ClassUtils::isTypeOraPointer(typ);
    if( !isContainer && !isOraPointer ){
      
      // loop over the data members
      typ.UpdateMembers();
      //std::vector<Reflex::Type> carrays;
      for ( size_t i=0; i< typ.DataMemberSize(); i++){
        Reflex::Member objMember = typ.DataMemberAt(i);

        // Skip the transient ones
        if ( objMember.IsTransient() ) continue;

        // Retrieve the field type
        Reflex::Type objMemberType = objMember.TypeOf();

        _sizeInColumns(objMemberType,sz, hasDependencies );
      }
    } else {
      hasDependencies = true;
    }    
  }
}
void ora::RelationalMapping::_sizeInColumnsForCArray ( const Reflex::Type &  typ,
size_t &  sz,
bool &  hasDependencies 
)

Definition at line 78 of file RelationalMapping.cc.

References _sizeInColumns(), and ora::ClassUtils::resolvedType().

Referenced by _sizeInColumns(), and sizeInColumnsForCArray().

                                                                      {
  // resolve possible typedef chains
  Reflex::Type typ = ClassUtils::resolvedType( topLevelClassType );
  if( !typ.IsArray()){
    return;
  }

  size_t arraySize = typ.ArrayLength();
  Reflex::Type arrayType = typ.ToType();
  size_t arrayElementSize = 0;
  _sizeInColumns(arrayType, arrayElementSize, hasDependencies);
  size_t totSize = arraySize*arrayElementSize;
  sz += totSize;
}
size_t ora::RelationalMapping::sizeInColumns ( const Reflex::Type &  topLevelClassType)

Definition at line 14 of file RelationalMapping.cc.

References _sizeInColumns().

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

                                                                       {
  size_t sz=0;
  bool hasDependencies = false;
  _sizeInColumns(topLevelClassType, sz, hasDependencies );
  return sz;
}
std::pair< bool, size_t > ora::RelationalMapping::sizeInColumnsForCArray ( const Reflex::Type &  arrayType)

Definition at line 22 of file RelationalMapping.cc.

References _sizeInColumnsForCArray().

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

                                                                                {
  size_t sz=0;
  bool hasDependencies = false;
  _sizeInColumnsForCArray(topLevelClassType, sz, hasDependencies );
  return std::make_pair(hasDependencies,sz);
}