diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2010-09-23 20:43:54 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2010-09-23 20:43:54 +0000 |
commit | 713c33e853a9dc0edc0bfb8b3b4d18a95ab54af1 (patch) | |
tree | 4916970caf5f9c2b1b8e42bc632442688880704d /DAnCE/dance/DAnCE_Utility.h | |
parent | 159ffc933cbb8c813027725c284d49af4102078a (diff) | |
download | ATCD-713c33e853a9dc0edc0bfb8b3b4d18a95ab54af1.tar.gz |
Thu Sep 23 20:41:48 UTC 2010 William R. Otte <wotte@dre.vanderbilt.edu>
* dance:
Moved most DAnCE code under this directory to match ACE+TAO layout.
* rules.dance.GNU:
Updated case of pat to version file.
* tests/DeploymentPlanDump/test.cpp:
* tests/DeploymentPlanTestReferences/test.cpp:
* tests/DeploymentTest1/test.cpp:
* tests/NameServiceTest/clt_main.cpp:
* tests/NameServiceTest/srv_main.cpp:
* tests/NodeApplicationManager-NodeApplication/test.cpp:
* tests/NodeManager-NodeApplicationManager/test.cpp:
* tests/Parsing/domain.cpp:
* tests/Parsing/test.cpp:
* tools/Artifact_Installation/Artifact_Installation_Handler_Svc.cpp:
* tools/Artifact_Installation/Artifact_Installation_Impl.h:
* tools/Artifact_Installation/Artifact_Installation_Impl.cpp:
* tools/Artifact_Installation/Artifact_Installation_exec.cpp:
* tools/Artifact_Installation/DAnCE_Artifact_Installation_Handler.idl:
* tools/Artifact_Installation/File_Installation_Handler.cpp:
* tools/Artifact_Installation/Http_Installation_Handler.cpp:
* tools/Artifact_Installation/Installation_Repository_Manager.cpp:
* tools/Artifact_Installation/Installation_Repository_Manager_Impl.cpp:
* tools/Config_Handlers/ADD_Handler.cpp:
* tools/Config_Handlers/Any_Handler.cpp:
* tools/Config_Handlers/CCD_Handler.cpp:
* tools/Config_Handlers/CEPE_Handler.cpp:
* tools/Config_Handlers/CPD_Handler.cpp:
* tools/Config_Handlers/CRDD_Handler.cpp:
* tools/Config_Handlers/ComponentPropertyDescription_Handler.cpp:
* tools/Config_Handlers/DD_Handler.cpp:
* tools/Config_Handlers/DP_Handler.cpp:
* tools/Config_Handlers/DP_PCD_Handler.cpp:
* tools/Config_Handlers/DataType_Handler.h:
* tools/Config_Handlers/DataType_Handler.cpp:
* tools/Config_Handlers/DnC_Dump.h:
* tools/Config_Handlers/DnC_Dump.cpp:
* tools/Config_Handlers/DnC_Dump_T.cpp:
* tools/Config_Handlers/Dump_Obj.h:
* tools/Config_Handlers/Dump_Obj.cpp:
* tools/Config_Handlers/DynAny_Handler/DynAlias_Handler.cpp:
* tools/Config_Handlers/DynAny_Handler/DynAny_Handler.cpp:
* tools/Config_Handlers/DynAny_Handler/DynEnum_Handler.cpp:
* tools/Config_Handlers/DynAny_Handler/DynSequence_Handler.cpp:
* tools/Config_Handlers/DynAny_Handler/DynStruct_Handler.cpp:
* tools/Config_Handlers/ERE_Handler.cpp:
* tools/Config_Handlers/ESD_Handler.cpp:
* tools/Config_Handlers/IDD_Handler.cpp:
* tools/Config_Handlers/IDREF_Base.cpp:
* tools/Config_Handlers/ID_Handler.cpp:
* tools/Config_Handlers/IRDD_Handler.cpp:
* tools/Config_Handlers/MDD_Handler.cpp:
* tools/Config_Handlers/PCD_Handler.cpp:
* tools/Config_Handlers/PL_Handler.cpp:
* tools/Config_Handlers/PSPE_Handler.cpp:
* tools/Config_Handlers/Package_Handlers/CAD_Handler.h:
* tools/Config_Handlers/Package_Handlers/CAD_Handler.cpp:
* tools/Config_Handlers/Package_Handlers/CID_Handler.cpp:
* tools/Config_Handlers/Package_Handlers/CPD_Handler.cpp:
* tools/Config_Handlers/Package_Handlers/Comp_Intf_Descr_Handler.h:
* tools/Config_Handlers/Package_Handlers/Comp_Intf_Descr_Handler.cpp:
* tools/Config_Handlers/Package_Handlers/IAD_Handler.cpp:
* tools/Config_Handlers/Package_Handlers/NIA_Handler.h:
* tools/Config_Handlers/Package_Handlers/PCD_Handler.cpp:
* tools/Config_Handlers/Package_Handlers/PC_Intf.cpp:
* tools/Config_Handlers/Package_Handlers/SID_Handler.cpp:
* tools/Config_Handlers/Property_Handler.cpp:
* tools/Config_Handlers/RDD_Handler.cpp:
* tools/Config_Handlers/Req_Handler.cpp:
* tools/Config_Handlers/STD_CID_Handler.h:
* tools/Config_Handlers/STD_CID_Handler.cpp:
* tools/Config_Handlers/STD_CPD_Handler.cpp:
* tools/Config_Handlers/STD_PC_Intf.cpp:
* tools/Config_Handlers/SatisfierProperty_Handler.cpp:
* tools/Config_Handlers/XML_File_Intf.cpp:
* tools/Convert_Plan/Convert_Plan.cpp:
* tools/Convert_Plan/Convert_Plan_Impl.h:
* tools/Convert_Plan/Convert_Plan_Impl.cpp:
* tools/Split_Plan/Locality_Splitter.h:
* tools/Split_Plan/Locality_Splitter.cpp:
* tools/Split_Plan/Node_Splitter.h:
* tools/Split_Plan/Node_Splitter.cpp:
* tools/Split_Plan/Split_Plan.h:
* tools/Split_Plan/Split_Plan.cpp:
* tools/Split_Plan/Split_Plan_exec.cpp:
* tools/Split_Plan/Sub_UUID_Generator.h:
* tools/System_Health/Daemon/SHS_Daemon.cpp:
* tools/System_Health/Daemon/SHS_Daemon_Impl.cpp:
* tools/System_Health/Interceptors/SHS_CORBA_Transport.cpp:
* tools/System_Health/Interceptors/SHS_Interceptor.h:
* tools/System_Health/Interceptors/SHS_Interceptor.cpp:
* tools/System_Health/Interceptors/SHS_Transport.h:
* tools/System_Health/SHS_DataModel.idl:
Updates from the re-arrangement.
Diffstat (limited to 'DAnCE/dance/DAnCE_Utility.h')
-rw-r--r-- | DAnCE/dance/DAnCE_Utility.h | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/DAnCE/dance/DAnCE_Utility.h b/DAnCE/dance/DAnCE_Utility.h new file mode 100644 index 00000000000..47b92f48f19 --- /dev/null +++ b/DAnCE/dance/DAnCE_Utility.h @@ -0,0 +1,148 @@ +// $Id$ + +/** + * @file DAnCE_Utility.h + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * + * Utility methods used throughought DAnCE. + + */ + +#ifndef DAnCE_Utility_H +#define DAnCE_Utility_H + +#include /**/ "ace/pre.h" + +#include "dance/DAnCE_stub_export.h" + +#include "ace/config-all.h" +#include "ace/Hash_Map_Manager_T.h" +#include "ace/Refcounted_Auto_Ptr.h" +#include "tao/AnyTypeCode/Any.h" +#include "dance/Deployment/Deployment_DeploymentPlanC.h" +#include "dance/Logger/Log_Macros.h" + +namespace DAnCE +{ + namespace Utility + { + typedef ACE_Hash_Map_Manager_Ex<ACE_CString, + CORBA::Any, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> PROPERTY_MAP; + + typedef ACE_Refcounted_Auto_Ptr <PROPERTY_MAP, + TAO_SYNCH_MUTEX> PMAP_PTR; + + DANCE_STUB_Export void build_property_map (PROPERTY_MAP &map, + const ::Deployment::Properties &prop); + + DANCE_STUB_Export void build_property_sequence (::Deployment::Properties &prop, + const PROPERTY_MAP &map); + + template<class T> + bool + get_property_value (const char *name, + const PROPERTY_MAP &properties, + T &val); + + template<class T> + bool + get_property_value (const char *name, + const ::Deployment::Properties &properties, + T &val); + + template<class T> + void + update_property_value (const char *name, + ::Deployment::Properties &properties, + const T &val); + + template <typename EXCEPTION> + void test_and_set_exception (bool &flag, EXCEPTION &exception, + const char *name, const char *reason); + + + DANCE_STUB_Export const char * + get_instance_type (const ::Deployment::Properties& prop); + + DANCE_STUB_Export void append_properties (::Deployment::Properties &dest, + const ::Deployment::Properties &src); + + /// Write a string (usually a stringified IOR) to a file + /// designated by the @a pathname. The file named will always get + /// overwritten. + DANCE_STUB_Export int write_IOR (const ACE_TCHAR *pathname, + const char *IOR); + + /// Attempt to extract the any into EXCEPTION type and + /// throw. Returns 'false' if extraction fails. + template <typename EXCEPTION> + bool extract_and_throw_exception (const CORBA::Any &excep); + + DANCE_STUB_Export bool + throw_exception_from_any (const CORBA::Any &excep); + + template <typename EXCEPTION> + CORBA::Any* create_any_from_exception (const EXCEPTION& ex); + + DANCE_STUB_Export CORBA::Any* + create_any_from_user_exception (const CORBA::UserException& ex); + + template <typename EXCEPTION> + bool stringify_exception (const CORBA::Any &excep, + std::string &result); + + DANCE_STUB_Export bool + stringify_exception_from_any (const CORBA::Any &excep, std::string &result); + } +} + +// Template specializations. +namespace DAnCE +{ + namespace Utility + { + template<> + DANCE_STUB_Export bool + get_property_value (const char *name, + const PROPERTY_MAP &properties, bool &val); + + template<> + DANCE_STUB_Export bool + get_property_value (const char *name, + const PROPERTY_MAP &properties, const char *&val); + + template<> + DANCE_STUB_Export bool + get_property_value (const char *name, + const ::Deployment::Properties &properties, + const char * &val); + + template<> + DANCE_STUB_Export bool + get_property_value (const char *name, + const ::Deployment::Properties &properties, + bool &val); + + template<char*> + DANCE_STUB_Export void + update_property_value (const char *name, + ::Deployment::Properties &properties, + const char * &val); + } +} + + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "dance/DAnCE_Utility.tpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("dance/DAnCE_Utility.tpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + + +#include /**/ "ace/post.h" +#endif |