//*-- Author : Valeriy Onuchin 11/09/2000 
//
//
////////////////////////////////////////////////////////////////////////////////
//
// rooType corresponds to d_Type Class
//
// The abstract class rooType represents descriptors for types in the schema 
// of the federated database.
//
//______________________________________________________________________________
//
//                 About Type Descriptors
//
// An instance of any concrete class derived from d_Type is called a type 
// descriptor;it provides information about a particular type, called its 
// described type. Concrete derived classes represent descriptors for:
//
//    - Classes
//    - Attribute types
//    - Relationship types
//
// Because this class is abstract, you never instantiate it; instead, you work
// with instances of its concrete derived classes. You should not derive your 
//own classes from this class.

#include "rooObjy.h"
#include <ooas.h>
#include <oo.h>

ClassImp(rooType)

////////////////////////////////////////////////////////////////////////////////
//______________________________________________________________________________
 rooType::rooType()
{
   // default ctor. , for internal use only 

   fImp = 0;
}

//______________________________________________________________________________
 rooType::~rooType()
{
   // dtor, for internal use only 
   
   fImp = 0;
}

//______________________________________________________________________________
 rooCollectionTypeItr rooType::used_in_collection_type_begin()
{
   // Gets an iterator for the collection types in the schema that are created 
   // from the described type.

   rooCollectionTypeItr itr;
   if(!fImp) return itr;

   *((collection_type_iterator*)itr.getImp()) = 
                     ((d_Type*)fImp)->used_in_collection_type_begin();
   return itr; 
}

//______________________________________________________________________________
 rooCollectionTypeItr rooType::used_in_collection_type_end()
{
   // Gets an iterator representing the termination condition for iteration 
   // through the collection types that are created from the described type.
   //
   // You can compare the iterator returned by used_in_collection_type_begin
   // with the one returned by this member function to test whether iteration 
   // has finished.

   rooCollectionTypeItr itr;
   if(!fImp) return itr;

   *((collection_type_iterator*)itr.getImp()) = 
                        ((d_Type*)fImp)->used_in_collection_type_end();

   return itr; 
}

//______________________________________________________________________________
 rooRefTypeItr rooType::used_in_ref_type_begin()
{
   // Gets an iterator for the object-reference types in the schema that 
   // reference the described type. 

   rooRefTypeItr itr;
   if(!fImp) return itr;

   *((ref_type_iterator*)itr.getImp()) = ((d_Type*)fImp)->used_in_ref_type_begin();
   return itr; 
}

//______________________________________________________________________________
 rooRefTypeItr rooType::used_in_ref_type_end()
{
   // Gets an iterator representing the termination condition for iteration
   // through the object-reference types that reference the described type.

   rooRefTypeItr itr;
   if(!fImp) return itr;

   *((ref_type_iterator*)itr.getImp()) = ((d_Type*)fImp)->used_in_ref_type_end();
   return itr;
}

//______________________________________________________________________________
 rooPropertyItr rooType::used_in_property_begin()
{
   // Returns a property iterator that finds all properties in the schema that 
   // use the described type.
   //
   // The returned iterator gets generic property descriptors for each property 
   // that uses the described type. You can call the is_relationship_type 
   // member function to find out whether the described type is a relationship
   // type. If so, you can cast the property descriptors to relationship
   // descriptors; if not, you can cast the property descriptors to attribute
   // descriptors.
 
   rooPropertyItr itr;
   if(!fImp) return itr;

   *((property_iterator*)itr.getImp()) = ((d_Type*)fImp)->used_in_property_begin();
   return itr; 
}

//______________________________________________________________________________
 rooPropertyItr rooType::used_in_property_end()
{
   // Returns a property iterator that is positioned after the last related 
   // property.
   //
   // You can compare the iterator returned by used_in_property_begin with the
   // one returned by this member function to test whether iteration has 
   // finished.

   rooPropertyItr itr;
   if(!fImp) return itr;

   *((property_iterator*)itr.getImp()) = ((d_Type*)fImp)->used_in_property_end();
   return itr;
}

//______________________________________________________________________________
 Int_t rooType::dimension() const
{
   // Returns the layout size in bytes for a value of the described type on the
   // platform where the current application is running.
   //
   // If the described type is a class, the result is the number of bytes 
   // required to store an instance of that class.
   // If the described type is a property type, the result is the number of 
   // bytes required to store a property of this type within the data of an 
   // instance of a class that contains the property. 

   return fImp ? ((d_Type*)fImp)->dimension() : 0;
}

//______________________________________________________________________________
 Int_t rooType::type_number() const
{
   // Non-class types will be assigned a unique 32-bit AStypeNumberCode
   // OR-constructed with a set high bit, the ooMemberType shifted left
   // 27, and the referenced or collected class number or referenced
   // ooBaseType.  For class types, type_number returns the Objectivity
   // type number.

   return fImp ? ((d_Type*)fImp)->type_number() : 0;
}

//______________________________________________________________________________
const rooModule & rooType::defined_in_module()
{
   // Returns a module descriptor for the module containing the described type.

   if(!fImp) return 0;
   const d_Module& mod = ((d_Type*)fImp)->defined_in_module();
   if(!mod) return 0;
   
   if(!fDefinedInModule) fDefinedInModule = new rooModule((void*)&mod);      
   else fDefinedInModule->setImp((void*)&mod);
   return *fDefinedInModule;
}

//______________________________________________________________________________
 Bool_t rooType::is_basic_type() const
{
   // Returns kTRUE if the described type is a basic numeric type; 
   // otherwise, kFALSE.

   return fImp ? ((d_Type*)fImp)->is_basic_type() : 0;
}

//______________________________________________________________________________
 Bool_t rooType::is_varray_type() const
{
   // Returns kTRUE if the described type is a VArray type; otherwise, kFALSE.

   return fImp ? ((d_Type*)fImp)->is_varray_type() : 0;
}

//______________________________________________________________________________
 Bool_t rooType::is_varray_basic_type() const
{
   // Returns kTRUE if the described type is a VArray of numeric elements; 
   // otherwise, kFALSE.

   return fImp ? ((d_Type*)fImp)->is_varray_basic_type() : 0;
}

//______________________________________________________________________________
 Bool_t rooType::is_varray_embedded_class_type() const
{
   // Returns kTRUE if the described type is an embedded-class VArray type; 
   // otherwise, kFALSE.

   return fImp ? ((d_Type*)fImp)->is_varray_embedded_class_type() : 0;
}

//______________________________________________________________________________
 Bool_t rooType::is_varray_ref_type() const
{
   // Returns kTRUE if the described type is an object-reference VArray type; 
   // otherwise, kFALSE. 

   return fImp ? ((d_Type*)fImp)->is_varray_ref_type() : 0;
}

//______________________________________________________________________________
 Bool_t rooType::is_relationship_type() const
{
   // Returns kTRUE if the described type is a relationship type; 
   // otherwise, kFALSE.

   return fImp ? ((d_Type*)fImp)->is_relationship_type() : 0;
}

//______________________________________________________________________________
 Bool_t rooType::is_unidirectional_relationship_type() const
{
   // Returns kTRUE if the described type is a unidirectional relationship type;
   // otherwise, kFALSE.

   return fImp ? ((d_Type*)fImp)->is_unidirectional_relationship_type() : 0;
}

//______________________________________________________________________________
 Bool_t rooType::is_bidirectional_relationship_type() const
{
   // Returns kTRUE if the described type is a bidirectional relationship type;
   //  otherwise, kFALSE.

   return fImp ? ((d_Type*)fImp)->is_bidirectional_relationship_type() : 0;
}

//______________________________________________________________________________
 Bool_t rooType::is_ref_type() const
{
   // Returns kTRUE if the described type is an object-reference type 
   // ooRef( PCclass) or ooShortRef( PCclass); otherwise, kFALSE

   return fImp ? ((d_Type*)fImp)->is_ref_type() : 0;
}

//______________________________________________________________________________
 Bool_t rooType::is_string_type() const
{
   // Returns kTRUE if the described type is a string class; otherwise, 
   // kFALSE. The string classes are:
   //
   //    - The ASCII string class ooVString
   //    - The optimized string classes ooString( N)
   //    - The Unicode string class ooUTF8String
   //    - The Smalltalk string class ooSTString 

   return fImp ? ((d_Type*)fImp)->is_string_type() : 0;
}




ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.