//*-- Author : Valeriy Onuchin 11/09/2000
//
//
////////////////////////////////////////////////////////////////////////////////
//
// rooMetaObject corresponds to d_Meta_Object Class
//
// The class rooMetaObject is the abstract base class for descriptor classes
// that describe named entities (modules, classes, attributes, and so on) in
// the federated database schema, and for descriptor classes that describe
// proposed additions or modifications to the schema. Each concrete class
// derived from this class describes one particular kind of schema entity or
// proposal. An instance of any concrete class derived from rooMetaObject is
// called a descriptor.
//
//______________________________________________________________________________
//
// About Descriptors
//
// As the name of this class implies, a descriptor is a meta-object -- that is,
// an object that provides information about a "real" object. Each descriptor
// provides information about a particular named entity in a federated database
// called its described entity. In addition to the persistent information from
// the federated database schema, a descriptor can have a transient comment.
// The comment is associated with a descriptor only during the interaction in
// which the descriptor was obtained; it is not saved persistently with the
// described entity in the federated database schema.
// 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.
//
////////////////////////////////////////////////////////////////////////////////
//
// rooMetaObject( aka d_Meta_Object) is part of the ODMG standard.
// A rooMetaObject has a name which can be looked up in a scope. Types,
// including classes, are meta-objects named in rooModule(aka d_Module,schema)
// scope and class attributes are meta-objects named in
// rooClass(aka d_Class) scope.
// All rooMetaObjects have a name string returned by name(). Comments
// added with set_comment() are transient only; they are not saved in
// the database. The id() method returns an unsigned integer unique to
// the meta-object within its scope; for subclasses of rooType(aka d_Type),
// its return value will be the same as for type_number(), and for subclasses
// of rooProperty(aka d_Property), its return value will be the Objectivity
// member ID. The method defined_in() returns the scope of the object.
//
// rooMetaObjects are never constructed, only returned by scope methods.
// For example:
//
// const rooMetaObject &metaObjConstRef = module.resolve("typeName");
//
////////////////////////////////////////////////////////////////////////////////
#include "rooObjy.h"
#include <ooas.h>
#include <oo.h>
ClassImp(rooMetaObject)
////////////////////////////////////////////////////////////////////////////////
//______________________________________________________________________________
rooMetaObject::rooMetaObject()
{
// internal use only
fImp = new d_Meta_Object();
}
//______________________________________________________________________________
rooMetaObject::~rooMetaObject()
{
// dtor.
// if(fImp) delete ((d_Meta_Object*)fImp);
// fImp = 0;
// if(fScope) delete (d_Scope*)fScope;
// fScope = 0;
}
//______________________________________________________________________________
TString rooMetaObject::name() const
{
// Gets the name of the described entity.
return fImp ? TString(((d_Meta_Object*)fImp)->name()) : TString();
}
//______________________________________________________________________________
TString rooMetaObject::comment() const
{
// Gets the transient comment associated with this descriptor.
//
// See also set_comment()
return fImp ? TString(((d_Meta_Object*)fImp)->comment()) : TString();
}
//______________________________________________________________________________
//rooScope & rooMetaObject::defined_in()
//{
//
//
// if(!fScope) fScope = new rooScope(&((d_Meta_Object*)fImp)->defined_in());
// else fScope->setScopeImp((void*)&((d_Meta_Object*)fImp)->defined_in());
//
// return *fScope;
//}
//______________________________________________________________________________
UInt_t rooMetaObject::id() const
{
// Gets the unique ID that identifies the described entity within its scope.
// Returns The ID for the described entity, or kooNoID if the described
// entity does not have an ID. If this is the null descriptor, this member
// function returns 0.
// Existing entities in the schema have IDs; proposed changes to the
// schema do not. Active Schema uses an ID to identify an existing entity
// uniquely within its scope. If the described entity is a class or
// non-class type, its ID is the same as its type number. If the described
// entity is a property, its ID is the same as its Objectivity
// attribute ID.
return fImp ? ((d_Meta_Object*)fImp)->id() : 0;
}
//______________________________________________________________________________
Bool_t rooMetaObject::is_type() const
{
// Tests whether the described entity is a type.
return fImp ? ((d_Meta_Object*)fImp)->is_type() : 0;
}
//______________________________________________________________________________
Bool_t rooMetaObject::is_class() const
{
// ests whether the described entity is a class.
return fImp ? ((d_Meta_Object*)fImp)->is_class() : 0;
}
//______________________________________________________________________________
Bool_t rooMetaObject::is_module() const
{
// Tests whether the described entity is a module.
return fImp ? ((d_Meta_Object*)fImp)->is_module() : 0;
}
//______________________________________________________________________________
void rooMetaObject::set_comment(const TString& comm)
{
// Sets the transient comment for this descriptor, replacing any
// existing comment.
//
// The comment is associated with this descriptor only during the
// interaction in which this descriptor was obtained; it is not saved
// persistently with the described entity in the federated database schema.
//
// See also comment()
if(fImp) ((d_Meta_Object*)fImp)->set_comment(comm.Data());
}
//______________________________________________________________________________
rooMetaObject::operator size_t() const
{
// Returns zero if this descriptor is null; otherwise, nonzero.
//
// Any member function that looks up a descriptor returns a descriptor
// object; unsuccessful searches return a null descriptor. This operator
// allows you to use a descriptor as an integer expression to test whether
// that descriptor is valid (not null).
//
// When this member function is called for a valid descriptor of an entity
// in the schema, it returns the unique ID of that entity.
return fImp ? (size_t)(*((d_Meta_Object*)fImp)) : 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.