diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-04-07 04:29:10 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-04-07 04:29:10 +0000 |
commit | 43a10dcf9be58755eb039b8d140cfcba00b523ce (patch) | |
tree | fd048ca4a633d4ed79940b03fe3242744189f55f | |
parent | 88e7fe803d07bd712ee4a16fe2f3218279a61f4e (diff) | |
download | ATCD-43a10dcf9be58755eb039b8d140cfcba00b523ce.tar.gz |
.
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.cpp | 6 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.h | 242 |
2 files changed, 120 insertions, 128 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.cpp b/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.cpp index 106f644c56a..3d5af7f1ccf 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.cpp @@ -1,4 +1,7 @@ +$Id$ + // ======================================================================== +// // $Id$ // // = LIBRARY @@ -28,7 +31,8 @@ TAO_Service_Type_Repository (ACE_Lock* lock) // If a lock wasn't provided, let's assume the user doesn't want any // kind of lock at all. if (this->lock_ == 0) - ACE_NEW (this->lock_, ACE_Lock_Adapter<ACE_Null_Mutex> ()); + ACE_NEW (this->lock_, + ACE_Lock_Adapter<ACE_Null_Mutex> ()); } diff --git a/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.h b/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.h index 7041f24c476..e3673bd2b44 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.h @@ -1,4 +1,5 @@ /* -*- C++ -*- */ +$Id$ // ======================================================================== // $Id$ @@ -20,16 +21,13 @@ #include "Trader.h" -class TAO_ORBSVCS_Export TAO_Service_Type_Repository : - public POA_CosTradingRepos::ServiceTypeRepository - // +class TAO_ORBSVCS_Export TAO_Service_Type_Repository : public POA_CosTradingRepos::ServiceTypeRepository +{ // = TITLE // This class implements CosTradingRepos::ServiceTypeRepository // IDL interface. -{ public: - - TAO_Service_Type_Repository (ACE_Lock* lock = 0); + TAO_Service_Type_Repository (ACE_Lock *lock = 0); // Parameterize the Service_Type_Repository with a lock to serialize // access to the type repository map. A reader/writer lock is // probably best. The Service_Type_Repository assumes control of the @@ -38,24 +36,23 @@ public: ~TAO_Service_Type_Repository (void); virtual CosTradingRepos::ServiceTypeRepository::IncarnationNumber - incarnation (CORBA::Environment& _env); + incarnation (CORBA::Environment &_env); virtual CosTradingRepos::ServiceTypeRepository::IncarnationNumber - add_type (const char * name, - const char * if_name, - const CosTradingRepos::ServiceTypeRepository::PropStructSeq& props, - const CosTradingRepos::ServiceTypeRepository::ServiceTypeNameSeq& super_types, - CORBA::Environment& _env) + add_type (const char *name, + const char *if_name, + const CosTradingRepos::ServiceTypeRepository::PropStructSeq &props, + const CosTradingRepos::ServiceTypeRepository::ServiceTypeNameSeq &super_types, + CORBA::Environment &_env) TAO_THROW_SPEC ((CORBA::SystemException, - CosTrading::IllegalServiceType, - CosTradingRepos::ServiceTypeRepository::ServiceTypeExists, - CosTradingRepos::ServiceTypeRepository::InterfaceTypeMismatch, - CosTrading::IllegalPropertyName, - CosTrading::DuplicatePropertyName, - CosTradingRepos::ServiceTypeRepository::ValueTypeRedefinition, - CosTrading::UnknownServiceType, - CosTradingRepos::ServiceTypeRepository::DuplicateServiceTypeName)); - + CosTrading::IllegalServiceType, + CosTradingRepos::ServiceTypeRepository::ServiceTypeExists, + CosTradingRepos::ServiceTypeRepository::InterfaceTypeMismatch, + CosTrading::IllegalPropertyName, + CosTrading::DuplicatePropertyName, + CosTradingRepos::ServiceTypeRepository::ValueTypeRedefinition, + CosTrading::UnknownServiceType, + CosTradingRepos::ServiceTypeRepository::DuplicateServiceTypeName)); // BEGIN SPEC // The add_type operation enables the creation of new service types // in the service type repository. The caller supplies the "name" @@ -76,80 +73,77 @@ public: // when CORBA systems support IDL 64-bit integers.) // If the "name" parameter is malformed, then the - // CosTrading::IllegalServiceType exception is raised. ° If the type + // CosTrading::IllegalServiceType exception is raised. If the type // already exists, then the ServiceTypeExists exception is raised. ° // If the "if_name" parameter is not a sub-type of the interface // associated with a service type from which this service type is // derived, such that substitutability would be violated, then the - // InterfaceTypeMismatch exception is raised. ° If a property name + // InterfaceTypeMismatch exception is raised. If a property name // supplied in the "props" parameter is malformed, the - // CosTrading::IllegalPropertyName exception is raised. ° If the + // CosTrading::IllegalPropertyName exception is raised. If the // same property name appears two or more times in the "props" // parameter, the CosTrading::DuplicatePropertyName exception is - // raised. ° If a property value type associated with this service + // raised. If a property value type associated with this service // type illegally modifies the value type of a super-type's // property, or if two super-types incompatibly declare value types // for the same property name, then the ValueTypeRedefinition - // exception is raised. ° If one of the ServiceTypeNames in + // exception is raised. If one of the ServiceTypeNames in // "super_types" is malformed, then the // CosTrading::IllegalServiceType exception is raised. If one of the // ServiceTypeNames in "super_types" does not exist, then the - // CosTrading::UnknownServiceType exception is raised. ° If the same + // CosTrading::UnknownServiceType exception is raised. If the same // service type name is included two or more times in this // parameter, the DuplicateServiceTypeName exception is raised. // END SPEC - - virtual void remove_type (const char * name, - CORBA::Environment& _env) + virtual void remove_type (const char *name, + CORBA::Environment &_env) TAO_THROW_SPEC ((CORBA::SystemException, - CosTrading::IllegalServiceType, - CosTrading::UnknownServiceType, - CosTradingRepos::ServiceTypeRepository::HasSubTypes)); - + CosTrading::IllegalServiceType, + CosTrading::UnknownServiceType, + CosTradingRepos::ServiceTypeRepository::HasSubTypes)); // BEGIN SPEC // The remove_type operation removes the named type from the service - // type repository. ° If "name" is malformed, then the - // CosTrading::IllegalServiceType exception is raised. ° If "name" - // does not exist within the repository, then the - // CosTrading::UnknownServiceType exception is raised. ° If "name" - // has a service type which has been derived from it, then the - // HasSubTypes exception is raised. - // END SPEC + // type repository. If "name" is malformed, then the + // CosTrading::IllegalServiceType exception is raised. If + // "name" does not exist within the repository, then the + // CosTrading::UnknownServiceType exception is raised. If + // "name" has a service type which has been derived from it, then + // the HasSubTypes exception is raised. END SPEC - virtual CosTradingRepos::ServiceTypeRepository::ServiceTypeNameSeq* - list_types (const CosTradingRepos::ServiceTypeRepository::SpecifiedServiceTypes& which_types, - CORBA::Environment& _env) + virtual CosTradingRepos::ServiceTypeRepository::ServiceTypeNameSeq * + list_types (const CosTradingRepos::ServiceTypeRepository::SpecifiedServiceTypes &which_types, + CORBA::Environment &_env) TAO_THROW_SPEC ((CORBA::SystemException)); // BEGIN SPEC // The list_types operation permits a client to obtain the names of // service types which are in the repository. The "which_types" // parameter permits the client to specify one of two possible - // values: ° all types known to the repository ° all types + // values: all types known to the repository all types // added/modified since a particular incarnation number The names of // the requested types are returned by the operation for subsequent // querying via the describe_type or the fully_describe_type // operation. // END SPEC - virtual CosTradingRepos::ServiceTypeRepository::TypeStruct* - describe_type (const char * name, - CORBA::Environment& _env) + virtual CosTradingRepos::ServiceTypeRepository::TypeStruct * + describe_type (const char *name, + CORBA::Environment &_env) TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalServiceType, CosTrading::UnknownServiceType)); // BEGIN SPEC // The describe_type operation permits a client to obtain the - // details for a particular service type. ° If "name" is malformed, - // then the CosTrading::IllegalServiceType exception is raised. ° If + // details for a particular service type. If "name" is malformed, + // then the CosTrading::IllegalServiceType exception is raised. If // "name" does not exist within the repository, then the // CosTrading::UnknownServiceType exception is raised. // END SPEC - virtual CosTradingRepos::ServiceTypeRepository::TypeStruct* - fully_describe_type (const char * name, - CORBA::Environment& _env) + virtual CosTradingRepos::ServiceTypeRepository::TypeStruct * + fully_describe_type (const char *name, + CORBA::Environment &_env) TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalServiceType, CosTrading::UnknownServiceType)); @@ -159,14 +153,14 @@ public: // returned in the TypeStruct includes all properties inherited from // the transitive closure of its super types; the sequence of super // types in the TypeStruct contains the names of the types in the - // transitive closure of the super type relation. ° If "name" is + // transitive closure of the super type relation. If "name" is // malformed, then the CosTrading::IllegalServiceType exception is - // raised. ° If "name" does not exist within the repository, then + // raised. If "name" does not exist within the repository, then // the CosTrading::UnknownServiceType exception is raised. // END SPEC - virtual void mask_type (const char * name, - CORBA::Environment& _env) + virtual void mask_type (const char *name, + CORBA::Environment &_env) TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalServiceType, CosTrading::UnknownServiceType, @@ -176,127 +170,121 @@ public: // type (i.e., after being masked, exporters will no longer be able // to advertise offers of that particular type). The type continues // to exist in the service repository due to other service types - // being derived from it. ° If "name" is malformed, then the - // CosTrading::IllegalServiceType exception is raised. ° If "name" + // being derived from it. If "name" is malformed, then the + // CosTrading::IllegalServiceType exception is raised. If "name" // does not exist within the repository, then the - // CosTrading::UnknownServiceType exception is raised. ° If the type + // CosTrading::UnknownServiceType exception is raised. If the type // is currently in the masked state, then the AlreadyMasked // exception is raised. // END SPEC - virtual void unmask_type (const char * name, - CORBA::Environment& _env) + virtual void unmask_type (const char *name, + CORBA::Environment &_env) TAO_THROW_SPEC ((CORBA::SystemException, - CosTrading::IllegalServiceType, - CosTrading::UnknownServiceType, - CosTradingRepos::ServiceTypeRepository::NotMasked)); + CosTrading::IllegalServiceType, + CosTrading::UnknownServiceType, + CosTradingRepos::ServiceTypeRepository::NotMasked)); // BEGIN SPEC // The unmask_type undeprecates a type (i.e., after being unmasked, // exporters will be able to resume advertisement of offers of that - // particular type). ° If "name" is malformed, then the - // CosTrading::IllegalServiceType exception is raised. ° If "name" + // particular type). If "name" is malformed, then the + // CosTrading::IllegalServiceType exception is raised. If "name" // does not exist within the repository, then the - // CosTrading::UnknownServiceType exception is raised. ° If the type + // CosTrading::UnknownServiceType exception is raised. If the type // is not currently in the masked state, then the NotMasked // exception is raised. // END SPEC public: - struct Type_Info + class Type_Info { - // storage structure for information pertinent to the type. + // = TITLE + // Storage structure for information pertinent to the type. + public: CosTradingRepos::ServiceTypeRepository::TypeStruct type_struct_; - // standard type info. + // Standard type info. CORBA::Boolean has_subtypes_; - // names of subtypes. + // Names of subtypes. }; - typedef ACE_Hash_Map_Manager_Ex - < - TAO_String_Hash_Key, - CosTradingRepos::ServiceTypeRepository::PropStruct*, - ACE_Hash<TAO_String_Hash_Key>, - ACE_Equal_To<TAO_String_Hash_Key>, - ACE_Null_Mutex - > - Prop_Map; - - typedef ACE_Hash_Map_Manager_Ex - < - TAO_String_Hash_Key, - Type_Info*, - ACE_Hash<TAO_String_Hash_Key>, - ACE_Equal_To<TAO_String_Hash_Key>, - ACE_Null_Mutex - > - Service_Type_Map; - - void fully_describe_type_i (const CosTradingRepos::ServiceTypeRepository::TypeStruct& type_struct, - CosTradingRepos::ServiceTypeRepository::PropStructSeq& props, - CosTradingRepos::ServiceTypeRepository::ServiceTypeNameSeq& super_types); + typedef ACE_Hash_Map_Manager_Ex <TAO_String_Hash_Key, + CosTradingRepos::ServiceTypeRepository::PropStruct *, + ACE_Hash<TAO_String_Hash_Key>, + ACE_Equal_To<TAO_String_Hash_Key>, + ACE_Null_Mutex> + Prop_Map; + + typedef ACE_Hash_Map_Manager_Ex <TAO_String_Hash_Key, + Type_Info *, + ACE_Hash<TAO_String_Hash_Key>, + ACE_Equal_To<TAO_String_Hash_Key>, + ACE_Null_Mutex> + Service_Type_Map; + + void fully_describe_type_i (const CosTradingRepos::ServiceTypeRepository::TypeStruct &type_struct, + CosTradingRepos::ServiceTypeRepository::PropStructSeq &props, + CosTradingRepos::ServiceTypeRepository::ServiceTypeNameSeq &super_types); // Build a sequence aggregating the property names from all // supertypes of the type, and a sequence representing the // transitive closure of the super type relation. - void collect_inheritance_hierarchy (const CosTradingRepos::ServiceTypeRepository::TypeStruct& type_struct, - TAO_String_Queue& target); + void collect_inheritance_hierarchy (const CosTradingRepos::ServiceTypeRepository::TypeStruct &type_struct, + TAO_String_Queue &target); - void validate_properties (Prop_Map& prop_map, - const CosTradingRepos::ServiceTypeRepository::PropStructSeq& props, - CORBA::Environment& _env) + void validate_properties (Prop_Map &prop_map, + const CosTradingRepos::ServiceTypeRepository::PropStructSeq &props, + CORBA::Environment &_env) TAO_THROW_SPEC ((CosTrading::IllegalPropertyName, CosTrading::DuplicatePropertyName)); // Confirm that the properties in props have valid names, and aren't // duplicated. Cram those properties into the prop_map. - void validate_supertypes (Service_Type_Map& super_map, - const CosTradingRepos::ServiceTypeRepository::ServiceTypeNameSeq& super_types, - CORBA::Environment& _env) + void validate_supertypes (Service_Type_Map &super_map, + const CosTradingRepos::ServiceTypeRepository::ServiceTypeNameSeq &super_types, + CORBA::Environment &_env) TAO_THROW_SPEC ((CosTrading::IllegalServiceType, - CosTrading::UnknownServiceType, - CosTrading::DuplicatePropertyName)); + CosTrading::UnknownServiceType, + CosTrading::DuplicatePropertyName)); // Confirm that the each super type exists, and cram them into super_map. - void validate_inheritance (Prop_Map& prop_map, - const CosTradingRepos::ServiceTypeRepository::ServiceTypeNameSeq& super_types, - CORBA::Environment& _env) + void validate_inheritance (Prop_Map &prop_map, + const CosTradingRepos::ServiceTypeRepository::ServiceTypeNameSeq &super_types, + CORBA::Environment &_env) TAO_THROW_SPEC ((CosTradingRepos::ServiceTypeRepository::ValueTypeRedefinition)); // Ensure that properties of a super_type aren't having their types // or retstrictions redefined. - // void validate_interface (const char* if_name, - // Service_Type_Map& super_map, - // CORBA::Environment& _env) + // void validate_interface (const char *if_name, + // Service_Type_Map &super_map, + // CORBA::Environment &_env) // TAO_THROW_SPEC ((CosTradingRepos::ServiceTypeRepository::InterfaceTypeMismatch)); // Ensure that the interface type derives from its superclasses'. - void update_type_map (const char* name, - const char * if_name, - const CosTradingRepos::ServiceTypeRepository::PropStructSeq& props, - const CosTradingRepos::ServiceTypeRepository::ServiceTypeNameSeq& super_types, - Prop_Map& prop_map, - Service_Type_Map& super_map); + void update_type_map (const char *name, + const char *if_name, + const CosTradingRepos::ServiceTypeRepository::PropStructSeq &props, + const CosTradingRepos::ServiceTypeRepository::ServiceTypeNameSeq &super_types, + Prop_Map &prop_map, + Service_Type_Map &super_map); // Update the type map with the information contained in the // TypeStruct, prop_map, and super_map. - TAO_Service_Type_Repository (const TAO_Service_Type_Repository&); - TAO_Service_Type_Repository& operator= (const TAO_Service_Type_Repository&); + TAO_Service_Type_Repository (const TAO_Service_Type_Repository &); + TAO_Service_Type_Repository &operator= (const TAO_Service_Type_Repository &); - ACE_Lock* lock_; + ACE_Lock *lock_; // Lock with which to serialize access to the service type map. Service_Type_Map type_map_; - // Stores information for each service type in the repository. - // This is a mapping from service type name to a Type_Info struct - // which serves as a storage for various information for the given type. + // Stores information for each service type in the repository. This + // is a mapping from service type name to a Type_Info struct which + // serves as a storage for various information for the given type. CosTradingRepos::ServiceTypeRepository::IncarnationNumber incarnation_; - // incarnation number to be used for the next modification to the repository. + // Incarnation number to be used for the next modification to the + // repository. }; -// This are temporary functions, until the format of the incarnation number -// will be changed in the spec. - #endif /* TAO_SERVICE_TYPE_REPOSITORY_H */ |