📄 cospropertyservice_i.cpp
字号:
// CosPropertyService_i.cpp,v 1.69 2003/11/04 08:12:59 dhinton Exp
// ============================================================================
//
// = LIBRARY
// cos
//
// = FILENAME
// CosPropertyService_i.cpp
//
// = AUTHOR
// Alexander Babu Arulanthu <alex@cs.wustl.edu>
//
// ============================================================================
#include "orbsvcs/Property/CosPropertyService_i.h"
#include "ace/ACE.h"
#include "ace/OS_NS_string.h"
ACE_RCSID(Property, CosPropertyService_i, "CosPropertyService_i.cpp,v 1.69 2003/11/04 08:12:59 dhinton Exp")
// = Methods to deal with ACE_Hash_Map_Manager.
CosProperty_Hash_Key::CosProperty_Hash_Key (void)
{
}
CosProperty_Hash_Key::CosProperty_Hash_Key (const char * &name)
: pname_ (CORBA::string_dup (name))
{
}
CosProperty_Hash_Key::CosProperty_Hash_Key (const CosPropertyService::PropertyName &name)
: pname_ (CORBA::string_dup (name))
{
}
CosProperty_Hash_Key::CosProperty_Hash_Key (const CosProperty_Hash_Key &src)
: pname_ (src.pname_)
{
}
int
CosProperty_Hash_Key::operator == (const CosProperty_Hash_Key &hash_key) const
{
return (ACE_OS::strcmp (this->pname_,
hash_key.pname_) == 0);
}
u_long
CosProperty_Hash_Key::hash (void) const
{
u_long ret = ACE::hash_pjw (this->pname_);
return ret;
}
CosProperty_Hash_Key::~CosProperty_Hash_Key (void)
{
}
//======================================================================
CosProperty_Hash_Value::CosProperty_Hash_Value (void)
{
}
CosProperty_Hash_Value::CosProperty_Hash_Value (const CORBA::Any &any,
const CosPropertyService::PropertyModeType &mode)
: pvalue_ (any),
pmode_ (mode)
{
}
CosProperty_Hash_Value::CosProperty_Hash_Value (const CosProperty_Hash_Value &src)
: pvalue_ (src.pvalue_),
pmode_ (src.pmode_)
{
}
CosProperty_Hash_Value::~CosProperty_Hash_Value (void)
{
}
//======================================================================
// Constructor.
TAO_PropertySetFactory::TAO_PropertySetFactory (void)
{
}
// Destructor.
TAO_PropertySetFactory::~TAO_PropertySetFactory (void)
{
}
// Returns a new TAO_PropertySet object. "The property set returned
// will *not* have any initial properties." Keep sequence of things
// new'ed and at the destructor of the factory delete all these New'ed
// things.
CosPropertyService::PropertySet_ptr
TAO_PropertySetFactory::create_propertyset (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
// New a TAO_PropertySet.
TAO_PropertySet *new_set;
ACE_NEW_RETURN (new_set, TAO_PropertySet, 0);
// Successful, store this in the products sequence and return.
CORBA::ULong cur_len = this->propertyset_products_.length ();
this->propertyset_products_.length (cur_len + 1);
this->propertyset_products_[cur_len] = new_set;
return new_set->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
}
// Allows a client to create a new TAO_PropertySet with specific
// constraints. "All the properties will have *fixed-normal* modes".
CosPropertyService::PropertySet_ptr
TAO_PropertySetFactory::create_constrained_propertyset (const CosPropertyService::PropertyTypes &allowed_property_types,
const CosPropertyService::Properties &allowed_properties
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
CosPropertyService::ConstraintNotSupported))
{
TAO_PropertySet *new_set = 0;
CosPropertyService::PropertySet_ptr propset_ptr = 0;
ACE_TRY
{
// New a TAO_PropertySet using these constraints.
ACE_NEW_RETURN (new_set,
TAO_PropertySet (allowed_property_types,
allowed_properties
ACE_ENV_ARG_PARAMETER),
0);
ACE_TRY_CHECK;
// Successful, store this in the products sequence.
CORBA::ULong products_len = this->propertyset_products_.length ();
this->propertyset_products_.length (products_len + 1);
this->propertyset_products_[products_len] = new_set;
// All done.
propset_ptr = new_set->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
}
ACE_CATCH (CORBA::UserException, ex)
{
// Release the memory.
delete new_set;
// Throw the exception.
ACE_TRY_THROW (CosPropertyService::ConstraintNotSupported());
}
ACE_CATCH (CORBA::SystemException, ex)
{
// Release memory.
delete new_set;
// Throw the exception.
ACE_RE_THROW;
}
ACE_ENDTRY;
ACE_CHECK_RETURN (0);
return propset_ptr;
}
// Allows a client to create a new TAO_PropertySet with specific
// constraints. "All the properties will have *fixed-normal* modes".
CosPropertyService::PropertySet_ptr
TAO_PropertySetFactory::create_initial_propertyset (const CosPropertyService::Properties &initial_properties
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
CosPropertyService::MultipleExceptions))
{
TAO_PropertySet *new_set = 0;
CosPropertyService::PropertySet_ptr propset_ptr = 0;
ACE_TRY
{
// New a TAO_PropertySet.
ACE_NEW_RETURN (new_set,
TAO_PropertySet (initial_properties
ACE_ENV_ARG_PARAMETER),
0);
ACE_TRY_CHECK;
// Successful, store this in the products sequence.
CORBA::ULong products_len = this->propertyset_products_.length ();
this->propertyset_products_.length (products_len + 1);
this->propertyset_products_[products_len] = new_set;
// All done.
propset_ptr = new_set->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
}
ACE_CATCH (CosPropertyService::MultipleExceptions, ex)
{
// Release memory.
delete new_set;
// Throw the exception.
ACE_RE_THROW;
}
ACE_CATCH (CORBA::SystemException, ex)
{
// Release the memory.
delete new_set;
// Throw the exception.
ACE_RE_THROW;
}
ACE_ENDTRY;
ACE_CHECK_RETURN (0);
return propset_ptr;
}
// Destructor.
TAO_PropertySetDefFactory::~TAO_PropertySetDefFactory (void)
{
// Release all the new'ed products.
for (CORBA::ULong pi = 0;
pi < this->propertysetdef_products_.length ();
pi++)
delete this->propertysetdef_products_[pi];
}
//======================================================================
// Constrctor.
TAO_PropertySetDefFactory::TAO_PropertySetDefFactory (void)
{
}
// Returns a new TAO_PropertySetDef object. "The property setdef
// returned will *not* have any initial properties."
// Keep sequence of things new'ed and at the destructor of the factory
// delete all these New'ed things.
CosPropertyService::PropertySetDef_ptr
TAO_PropertySetDefFactory::create_propertysetdef (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
// New a TAO_PropertySetDef.
TAO_PropertySetDef *new_set;
ACE_NEW_RETURN (new_set, TAO_PropertySetDef, 0);
// Successful, store this in the products sequence and return.
CORBA::ULong cur_len = this->propertysetdef_products_.length ();
this->propertysetdef_products_.length (cur_len + 1);
this->propertysetdef_products_[cur_len] = new_set;
CosPropertyService::PropertySetDef_ptr propsetdef_ptr =
new_set->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
return propsetdef_ptr;
}
CosPropertyService::PropertySetDef_ptr
TAO_PropertySetDefFactory::create_constrained_propertysetdef (const CosPropertyService::PropertyTypes &allowed_property_types,
const CosPropertyService::PropertyDefs &allowed_property_defs
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
CosPropertyService::ConstraintNotSupported))
{
TAO_PropertySetDef *new_set = 0;
CosPropertyService::PropertySetDef_ptr propsetdef_ptr = 0;
ACE_TRY
{
// New a TAO_PropertySetDef using these constraints.
ACE_NEW_RETURN (new_set,
TAO_PropertySetDef (allowed_property_types,
allowed_property_defs
ACE_ENV_ARG_PARAMETER),
0);
ACE_TRY_CHECK;
// Successful, store this in the products sequence.
CORBA::ULong products_len = this->propertysetdef_products_.length ();
this->propertysetdef_products_.length (products_len + 1);
this->propertysetdef_products_[products_len] = new_set;
// All done. Return the pointer.
propsetdef_ptr = new_set->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
}
ACE_CATCH (CORBA::UserException, ex)
{
// Release the memory.
delete new_set;
// Throw the exception.
ACE_TRY_THROW (CosPropertyService::ConstraintNotSupported());
}
ACE_CATCH (CORBA::SystemException, ex)
{
// Release memory.
delete new_set;
// Throw the exception.
ACE_RE_THROW;
}
ACE_ENDTRY;
ACE_CHECK_RETURN (0);
return propsetdef_ptr;
}
// Allows the client to create a new TAO_PropertySetDef with specific
// initital constraints.
CosPropertyService::PropertySetDef_ptr
TAO_PropertySetDefFactory::create_initial_propertysetdef (const CosPropertyService::PropertyDefs &initial_property_defs
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
CosPropertyService::MultipleExceptions))
{
TAO_PropertySetDef *new_set = 0;
CosPropertyService::PropertySetDef_ptr propsetdef_ptr = 0;
ACE_TRY
{
// New a TAO_PropertySet using these lengths.
ACE_NEW_RETURN (new_set,
TAO_PropertySetDef (initial_property_defs
ACE_ENV_ARG_PARAMETER),
0);
ACE_TRY_CHECK;
// Successful, store this in the products sequence.
CORBA::ULong products_len = this->propertysetdef_products_.length ();
this->propertysetdef_products_.length (products_len + 1);
this->propertysetdef_products_[products_len] = new_set;
// All done.
propsetdef_ptr = new_set->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
}
ACE_CATCH (CosPropertyService::MultipleExceptions, ex)
{
// Release memory.
delete new_set;
// Throw the exception.
ACE_RE_THROW;
}
ACE_CATCH (CORBA::SystemException, ex)
{
// Release the memory.
delete new_set;
// Throw the exception.
ACE_RE_THROW;
}
ACE_ENDTRY;
ACE_CHECK_RETURN (0);
return propsetdef_ptr;
}
//======================================================================
// Makes default sized hash_table_. All the sequences are set the max
// length as 0.
TAO_PropertySet::TAO_PropertySet (void)
{
}
// Init values that the PropertySetFactory will want to specify. Write
// the allowed properties in the Hash Table with *fixed-normal* mode.
// @@ Need to check for duplicate properties and raise exceptions.
TAO_PropertySet::TAO_PropertySet (const CosPropertyService::PropertyTypes allowed_property_types,
const CosPropertyService::Properties allowed_properties
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -