/*
* This file is part of rasdaman community.
*
* Rasdaman community is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Rasdaman community is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with rasdaman community. If not, see .
*
* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
rasdaman GmbH.
*
* For more information please see
* or contact Peter Baumann via .
/
/**
* INLINE SOURCE: object.icc
*
* MODULE: rasodmg
* CLASS: r_Object
*
* COMMENTS:
* None
*/
#include
inline void
r_Object::mark_modified()
{
if( object_status == no_status ||
object_status == read )
object_status = modified;
};
inline void
r_Object::set_object_name( const char* name ) throw(r_Error)
{
if(!name) {
//null pointer
RMInit::logOut << "r_Object::set_object_name(name) name is null!" << std::endl;
throw r_Error(INVALIDOBJECTNAME);
}
const char* cptr=name;
//check if the name contains only [a-zA-Z0-9_]
while(*cptr) {
if( ((*cptr >= 'a') && (*cptr <='z')) ||
((*cptr >= 'A') && (*cptr <='Z')) ||
((*cptr >= '0') && (*cptr <='9')) ||
(*cptr == '_') )
cptr++;
else
break;
}
if(*cptr) {
//invalid character in object name
RMInit::logOut << "r_Object::set_object_name(" << name << ") invalid name!" << std::endl;
throw r_Error(INVALIDOBJECTNAME);
}
if( object_name )
free( object_name );
object_name = strdup( name );
};
inline void
r_Object::set_type_by_name( const char* name ) throw(r_Error)
{
if(!name) {
//null pointer
RMInit::logOut << "r_Object::set_type_by_name(name) name is null!" << std::endl;
throw r_Error(r_Error:: r_Error_NameInvalid);
}
if( type_name )
free( type_name );
type_name = strdup( name );
};
inline void
r_Object::set_type_structure( const char* name ) throw(r_Error)
{
if(!name) {
//null pointer
RMInit::logOut << "r_Object::type_structure(name) name is null!" << std::endl;
throw r_Error(r_Error:: r_Error_NameInvalid);
}
if( type_structure )
delete [] type_structure;
type_structure = new char[strlen(name) + 1];
strcpy(type_structure, name);
};
inline const char*
r_Object::get_type_name() const
{
return type_name;
};
inline const char*
r_Object::get_object_name() const
{
return object_name;
}
inline const char*
r_Object::get_type_structure() const
{
if (type_structure != NULL)
return type_structure;
else
return "";
};
inline r_Object::ObjectStatus
r_Object::get_status() const
{
return object_status;
};
inline const r_OId&
r_Object::get_oid() const
{
return oid;
}