[GME-commit]
GMESRC/SDK/BON BONImpl.cpp,1.34,1.35 BONImpl.h,1.20,1.21
Extensions.cpp,1.12,1.13
gme-commit at list.isis.vanderbilt.edu
gme-commit at list.isis.vanderbilt.edu
Mon Sep 25 19:09:14 CDT 2006
Update of /project/gme-repository/GMESRC/SDK/BON
In directory escher:/tmp/cvs-serv19795
Modified Files:
BONImpl.cpp BONImpl.h Extensions.cpp
Log Message:
Bon2 updated for namespacish logic.
1.#define NAMESPACE_PREF in ComponentConfig.h if you would like to affect the IMPLEMENT_BONEXTENSION macros.
This enables BonExtension based interpreter code to be re-used.
2.call project->setNmsp("...") runtime to set the current namespace.
This enables a (namespace-less) interpreter code to be re-used in a namespace-full metamodel.
CVS User: Zoltan Molnar, ISIS (zolmol)
Index: Extensions.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/SDK/BON/Extensions.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** Extensions.cpp 21 Jul 2006 19:40:01 -0000 1.12
--- Extensions.cpp 25 Sep 2006 18:09:12 -0000 1.13
***************
*** 25,43 ****
#include "Extensions.h"
#include "BONImpl.h"
namespace BON
{
- // =================================================================================
- // SPECIAL CARE needed for strNamespacePref variable
- // =================================================================================
- // use this default declaration generally:
- std::string strNamespacePref = "";
- //
- // use this extern declaration if you define the initial value
- // somewhere else e.g. bon2component.cpp, but in this case you
- // must do that in each component that shares the Extensions.cpp
- // file located in c:\program files\sdk\bon:
- //extern std::string strNamespacePref;
- // =================================================================================
void splitKinds( const std::string& strKinds, std::vector<std::string>& vecKinds )
{
--- 25,36 ----
#include "Extensions.h"
#include "BONImpl.h"
+ #include "Bon2component.h"
+
+ #ifndef NAMESPACE_PREF
+ #define NAMESPACE_PREF ""
+ #endif
namespace BON
{
void splitKinds( const std::string& strKinds, std::vector<std::string>& vecKinds )
{
***************
*** 109,112 ****
--- 102,106 ----
ExtensionType castImpl( ObjectType eOType, const std::string& strKind, const std::string& strRole, const std::string& strBEType, ObjectType eType, const std::vector<std::string>& vecKinds )
{
+ std::string strNamespacePref = NAMESPACE_PREF;
if ( strBEType.empty() )
{
Index: BONImpl.h
===================================================================
RCS file: /project/gme-repository/GMESRC/SDK/BON/BONImpl.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** BONImpl.h 21 Jul 2006 19:40:01 -0000 1.20
--- BONImpl.h 25 Sep 2006 18:09:12 -0000 1.21
***************
*** 193,200 ****
// Namespace related
public:
- static std::string prefixWNmspStatic( const std::string& pKindOrRole);
- static std::string getNmspStatic();
- static void setNmspStatic( const std::string& pNmsp);
-
std::string prefixWNmsp( const std::string& pKindOrRole) const;
std::string getNmsp();
--- 193,196 ----
***************
*** 202,207 ****
private:
- bool setNmspInTerritory();
std::string getNmspFrTerritory() const;
--- 198,203 ----
private:
std::string getNmspFrTerritory() const;
+ bool setNmspInTerritory();
Index: BONImpl.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/SDK/BON/BONImpl.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** BONImpl.cpp 21 Jul 2006 19:40:01 -0000 1.34
--- BONImpl.cpp 25 Sep 2006 18:09:12 -0000 1.35
***************
*** 27,37 ****
#include <ComponentConfig.h>
namespace BON
{
- //*****************************************************
- // this variable is used by macros and static createAs
- // methods, to find the proper kind
- extern std::string strNamespacePref;
- //*****************************************************
//###############################################################################################################################################
--- 27,37 ----
#include <ComponentConfig.h>
+ #ifndef NAMESPACE_PREF
+ #define NAMESPACE_PREF ""
+ #endif
+
+
namespace BON
{
//###############################################################################################################################################
***************
*** 778,796 ****
}
- /*static*/ std::string ProjectImpl::prefixWNmspStatic( const std::string& pKindOrRole)
- {
- return (strNamespacePref.empty()? "" : strNamespacePref + "::") + pKindOrRole;
- }
-
- /*static*/ std::string ProjectImpl::getNmspStatic()
- {
- return strNamespacePref;
- }
-
- /*static*/ void ProjectImpl::setNmspStatic( const std::string& pNmsp)
- {
- strNamespacePref = pNmsp;
- }
-
std::string ProjectImpl::getNmsp()
{
--- 778,781 ----
***************
*** 805,829 ****
}
! bool ProjectImpl::setNmspInTerritory()
{
if( m_spTerritory)
{
! m_spTerritory->SetNamespace( CComBSTR( m_nmsp.c_str()));
! return true;
}
ASSERT(0);
! return false;
}
! std::string ProjectImpl::getNmspFrTerritory() const
{
if( m_spTerritory)
{
! CComBSTR nms;
! m_spTerritory->GetNamespace( &nms);
! return Util::Copy( nms);
}
ASSERT(0);
! return "";
}
--- 790,814 ----
}
! std::string ProjectImpl::getNmspFrTerritory() const
{
if( m_spTerritory)
{
! CComBSTR nms;
! m_spTerritory->GetNamespace( &nms);
! return Util::Copy( nms);
}
ASSERT(0);
! return "";
}
! bool ProjectImpl::setNmspInTerritory()
{
if( m_spTerritory)
{
! m_spTerritory->SetNamespace( CComBSTR( m_nmsp.c_str()));
! return true;
}
ASSERT(0);
! return false;
}
***************
*** 6290,6294 ****
else {
for ( std::set<MON::Containment>::iterator it = metas.begin() ; it != metas.end() ; it++ ) {
! if ( (it->name() == strRole || it->name() == ProjectImpl::prefixWNmspStatic( strRole)) && it->child().type() == MON::OT_Connection ) {
role = *it;
break;
--- 6275,6279 ----
else {
for ( std::set<MON::Containment>::iterator it = metas.begin() ; it != metas.end() ; it++ ) {
! if ( (it->name() == strRole || it->name() == parent->getProject()->prefixWNmsp( strRole)) && it->child().type() == MON::OT_Connection ) {
role = *it;
break;
More information about the GME-commit
mailing list