[GME-commit] GMESRC/Paradigms/MetaGME/BonExtension/Rep Any.cpp,1.12,1.13 Any.h,1.9,1.10 Dumper.cpp,1.13,1.14 Dumper.h,1.7,1.8 FCO.cpp,1.18,1.19 Sheet.cpp,1.9,1.10 Sheet.h,1.8,1.9

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Wed Oct 20 22:04:40 CDT 2004


Update of /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep
In directory braindrain:/tmp/cvs-serv18474/Rep

Modified Files:
	Any.cpp Any.h Dumper.cpp Dumper.h FCO.cpp Sheet.cpp Sheet.h 
Log Message:
Capability to extract MOF stuff from the registry.



CVS User: zolmol

Index: Any.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Any.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** Any.cpp	30 Jul 2004 20:21:05 -0000	1.12
--- Any.cpp	21 Oct 2004 02:04:34 -0000	1.13
***************
*** 19,22 ****
--- 19,31 ----
  /*static*/ const std::string Any::InRootFolder_str = "InRootFolder";
  /*static*/ const std::string Any::NameSelectorNode_str = "myNameIs"; 
+ /*static*/ const std::string Any::MOFException_str = "MOFException";
+ /*static*/ const std::string Any::MOFOperation_str = "MOFOperation";
+ /*static*/ const std::string Any::MOFEnumeration_str = "MOFEnumeration";
+ /*static*/ const std::string Any::MOFStructure_str = "MOFStructure";
+ /*static*/ const std::string Any::MOFAlias_str = "MOFAlias";
+ 
+ /*static*/ const std::string Any::MOFStart_str = "MOF section begins";
+ /*static*/ const std::string Any::MOFEnd_str   = "MOF section ends";
+ 
  
  
***************
*** 285,292 ****
--- 294,504 ----
  
  
+ /*static*/ std::string Any::parseMOFException( const std::string& exc_str)
+ {
+ 	std::string ind0 = std::string( 2 - 1, '\t'), ind = std::string( 2, '\t'), more_ind = std::string( 2 + 1, '\t');
+ 
+ 	std::string res, ctor_signature, ctor_inilist, ctor_body, class_body, name;
+ 	unsigned int beg = 0, nwl = exc_str.find('\n');
+ 	name = exc_str.substr(0, nwl);
+ 
+ 	while( nwl != std::string::npos)
+ 	{
+ 		beg = nwl + 1;
+ 		nwl = exc_str.find('\n', beg);
+ 		
+ 		if( nwl > beg && beg < exc_str.length() - 1)
+ 		{
+ 			std::string par_line = exc_str.substr( beg, nwl - beg);
+ 			int type_end = par_line.find('\t');
+ 			std::string par_type, par_name;
+ 			par_type = par_line.substr(0, type_end);
+ 			par_name = par_line.substr( type_end + 1);
+ 
+ 			if( ctor_signature.empty()) ctor_signature = "\n" + more_ind + "( ";
+ 			else ctor_signature += "\n" + more_ind + ", ";
+ 			
+ 			if( ctor_body.empty()) ctor_body = "\n" + more_ind + ": ";
+ 			else ctor_body += "\n" + more_ind + ", ";
+ 			
+ 			ctor_signature += par_type + " p_" + par_name;
+ 			ctor_body += par_name + "( p_" + par_name + ")";
+ 			class_body += "\n" + ind + par_type + " " + par_name + ";";
+ 		}
+ 	}
+ 
+ 	if( name == exc_str) //no members
+ 	{
+ 		res = ind0 + "class " + name + "{ };\n";
+ 	}
+ 	else
+ 	{
+ 		ctor_signature = "\n" + ind + "// constructor\n" + ind + name + ctor_signature + "\n" + more_ind + ")";
+ 		ctor_body += "\n" + ind + "{ }";
+ 		class_body = "\n" + ind + "// members\n" + class_body;
+ 		res = ind0 + "class " + name + "\n" + ind0 + "{\n" + ind0 + "public:\n"  + ctor_signature + ctor_body + "\n" + class_body + "\n" + ind0 + "};\n";
+ 	}
+ 	return res;
+ }
+ 
+ 
+ /*static*/ std::string Any::parseMOFOperation( const std::string& exc_str)
+ {
+ 	std::string ind0 = std::string( 2 - 1, '\t'), ind = std::string( 2, '\t');
+ 
+ 	std::string res;
+ 	res = ind0 + exc_str;
+ 	if( exc_str.length() > 0 && exc_str[ exc_str.length() - 1 ] != '\n') res += '\n';
+ 	return res;
+ }
+ 
+ 
+ /*static*/ std::string Any::processMOFNode( const BON::RegistryNode& rn, int ind_num)
+ {
+ 	std::string mof;
+ 
+ 	// exceptions
+ 	bool any_more = true;
+ 	for( unsigned int c = 1; any_more; ++c)
+ 	{
+ 		any_more = false;
+ 
+ 		char bf[3];
+ 		sprintf(bf, "%u", c);
+ 		std::string query_str = MOFException_str + bf;
+ 		
+ 		BON::RegistryNode exc = rn->getChild( query_str);
+ 		if( exc)
+ 		{
+ 			std::string n = exc->getName();
+ 			n += ' ';
+ 		}
+ 
+ 		if( exc 
+ 			&& 1//( exc->getStatus() == BON::RNS_Here || exc->getStatus() == BON::RNS_Meta )
+ 			&& !exc->getValue().empty())
+ 		{
+ 			any_more = true;
+ 			mof += parseMOFException( exc->getValue()) + "\n";
+ 		}
+ 		else
+ 			any_more = false;
+ 				
+ 	}
+ 
+ 	// enums
+ 	any_more = true;
+ 	for( c = 1; any_more; ++c)
+ 	{
+ 		any_more = false;
+ 
+ 		char bf[3];
+ 		sprintf(bf, "%u", c);
+ 		std::string query_str = MOFEnumeration_str + bf;
+ 		
+ 		BON::RegistryNode exc = rn->getChild( query_str);
+ 		if( exc 
+ 			&& 1//( exc->getStatus() == BON::RNS_Here || exc->getStatus() == BON::RNS_Meta )
+ 			&& !exc->getValue().empty())
+ 		{
+ 			any_more = true;
+ 			mof += parseMOFOperation( exc->getValue()) + "\n";
+ 		}
+ 		else
+ 			any_more = false;
+ 	}
+ 
+ 	// structures
+ 	any_more = true;
+ 	for( c = 1; any_more; ++c)
+ 	{
+ 		any_more = false;
+ 
+ 		char bf[3];
+ 		sprintf(bf, "%u", c);
+ 		std::string query_str = MOFStructure_str + bf;
+ 		
+ 		BON::RegistryNode exc = rn->getChild( query_str);
+ 		if( exc 
+ 			&& 1//( exc->getStatus() == BON::RNS_Here || exc->getStatus() == BON::RNS_Meta )
+ 			&& !exc->getValue().empty())
+ 		{
+ 			any_more = true;
+ 			mof += parseMOFOperation( exc->getValue()) + "\n";
+ 		}
+ 		else
+ 			any_more = false;
+ 	}
+ 
+ 	// aliases
+ 	any_more = true;
+ 	for( c = 1; any_more; ++c)
+ 	{
+ 		any_more = false;
+ 
+ 		char bf[3];
+ 		sprintf(bf, "%u", c);
+ 		std::string query_str = MOFAlias_str + bf;
+ 		
+ 		BON::RegistryNode exc = rn->getChild( query_str);
+ 		if( exc 
+ 			&& 1//( exc->getStatus() == BON::RNS_Here || exc->getStatus() == BON::RNS_Meta )
+ 			&& !exc->getValue().empty())
+ 		{
+ 			any_more = true;
+ 			mof += parseMOFOperation( exc->getValue()) + "\n";
+ 		}
+ 		else
+ 			any_more = false;
+ 	}
+ 
+ 	// operations
+ 	any_more = true;
+ 	for( c = 1; any_more; ++c)
+ 	{
+ 		any_more = false;
+ 
+ 		char bf[3];
+ 		sprintf(bf, "%u", c);
+ 		std::string query_str = MOFOperation_str + bf;
+ 		
+ 		BON::RegistryNode exc = rn->getChild( query_str);
+ 		if( exc 
+ 			&& 1//( exc->getStatus() == BON::RNS_Here || exc->getStatus() == BON::RNS_Meta )
+ 			&& !exc->getValue().empty())
+ 		{
+ 			any_more = true;
+ 			mof += parseMOFOperation( exc->getValue()) + "\n";
+ 		}
+ 		else
+ 			any_more = false;
+ 	}
+ 
+ 	return mof;
+ }
+ 
+ 
+ void Any::prepareMOF()
+ {
+ 	BON::RegistryNode my_rn = m_ptr->getRegistry();
+ 	if( my_rn)
+ 		m_sectionMOF = Any::processMOFNode( my_rn);
+ 
+ 	std::set< BON::FCO >::const_iterator it = m_equivs.begin();
+ 	for ( ; it != m_equivs.end(); ++it)
+ 	{
+ 		if( m_ptr == *it) continue;
+ 
+ 		BON::RegistryNode rn = (*it)->getRegistry();
+ 		if( rn)
+ 			m_sectionMOF += Any::processMOFNode( rn);
+ 	}
+ }
+ 
+ 
  void Any::prepare()
  {
  	prepareMacros();
  	prepareIniFin();
+ 	prepareMOF();
  }
  
***************
*** 323,327 ****
  void Any::dumpPost( std::string & h_file, std::string & c_file)
  {
! 	h_file += "\n" + CodeGen::indent(1) + m_startUPToken + "\n" + getUserPart() + CodeGen::indent(1) +  m_endUPToken+ "\n};\n\n\n";
  }
  
--- 535,548 ----
  void Any::dumpPost( std::string & h_file, std::string & c_file)
  {
! 	h_file += "\n" + CodeGen::indent(1) + m_startUPToken + "\n" + getUserPart() + CodeGen::indent(1) +  m_endUPToken+ "\n";
! 	
! 	if( !m_sectionMOF.empty())
! 	{
! 		h_file += "\n// " + Any::MOFStart_str + "\n";
! 		h_file += "public:\n" + m_sectionMOF + "\n";
! 		h_file += "// " + Any::MOFEnd_str + "\n\n";
! 	}
! 	
! 	h_file += "};\n\n\n";
  }
  

Index: Any.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Any.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Any.h	30 Jul 2004 20:21:05 -0000	1.9
--- Any.h	21 Oct 2004 02:04:34 -0000	1.10
***************
*** 24,27 ****
--- 24,40 ----
  	static const std::string InRootFolder_str;//"InRootFolder"
  	static const std::string NameSelectorNode_str; //"myNameIs"
+ 
+ 	static const std::string m_startUPToken;
+ 	static const std::string m_endUPToken;
+ 
+ 	static const std::string MOFException_str;//"MOFException"
+ 	static const std::string MOFOperation_str; //"MOFOperation"
+ 	static const std::string MOFEnumeration_str;//"MOFEnumeration"
+ 	static const std::string MOFStructure_str; //"MOFStructure"
+ 	static const std::string MOFAlias_str; //"MOFAlias"
+ 
+ 	static const std::string MOFStart_str;
+ 	static const std::string MOFEnd_str;
+ 
  public: // types
  	typedef enum
***************
*** 86,89 ****
--- 99,103 ----
  	virtual void prepareMacros();
  	virtual void prepareIniFin();
+ 	void         prepareMOF();
  
  	void dumpGlobals();
***************
*** 100,106 ****
  	void toBeEx( bool t);
  
! public:
! 	static const std::string m_startUPToken;
! 	static const std::string m_endUPToken;
  
  protected:
--- 114,120 ----
  	void toBeEx( bool t);
  
! 	static std::string processMOFNode( const BON::RegistryNode& n, int ind = 2);
! 	static std::string parseMOFException( const std::string& exc_str);
! 	static std::string parseMOFOperation( const std::string& exc_str);
  
  protected:
***************
*** 119,122 ****
--- 133,137 ----
  
  	std::vector< Method > m_inifinMethods;
+ 	std::string m_sectionMOF;
  	std::string m_globalHeader;
  	std::string m_globalSource;

Index: Dumper.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Dumper.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** Dumper.cpp	30 Jul 2004 20:21:05 -0000	1.13
--- Dumper.cpp	21 Oct 2004 02:04:34 -0000	1.14
***************
*** 280,283 ****
--- 280,303 ----
  }
  
+ void Dumper::dumpGlobalMOF()
+ {
+ 	std::string res;
+ 
+ 	std::set<BON::Model>::iterator it = m_setOfParadigmSheets.begin();
+ 	for( ; it != m_setOfParadigmSheets.end(); ++it)
+ 	{
+ 		BON::RegistryNode rn = (*it)->getRegistry();
+ 		if( rn)
+ 			res += Any::processMOFNode( rn, 1);
+ 
+ 	}
+ 
+ 	if( !res.empty())
+ 	{
+ 		DMP_H( "// Global " + Any::MOFStart_str + "\n\n");
+ 		DMP_H( res);
+ 		DMP_H( "// Global " + Any::MOFEnd_str + "\n\n\n");
+ 	}
+ }
  
  void Dumper::doDump()
***************
*** 349,352 ****
--- 369,374 ----
  	DMP_S("namespace " + getNamespaceName() + "\n{\n");
  	
+ 	dumpGlobalMOF();
+ 
  	dumpMain( sorted);
  

Index: Dumper.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Dumper.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Dumper.h	16 Jun 2004 18:35:02 -0000	1.7
--- Dumper.h	21 Oct 2004 02:04:34 -0000	1.8
***************
*** 40,43 ****
--- 40,44 ----
  	void createMethods();
  	void dumpGlobals( std::vector<FCO*>& s);
+ 	void dumpGlobalMOF();
  	void dumpMain( std::vector<FCO*>& s);
  	void doDump();

Index: FCO.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/FCO.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** FCO.cpp	30 Jul 2004 20:21:05 -0000	1.18
--- FCO.cpp	21 Oct 2004 02:04:34 -0000	1.19
***************
*** 811,814 ****
--- 811,815 ----
  	prepareMacros();
  	prepareIniFin();
+ 	prepareMOF();
  	prepareAttributes();
  }

Index: Sheet.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Sheet.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Sheet.cpp	30 Jul 2004 20:21:05 -0000	1.9
--- Sheet.cpp	21 Oct 2004 02:04:34 -0000	1.10
***************
*** 10,14 ****
  
  Sheet * Sheet::m_theOnlyInstance = 0;
! /*static*/ BON::Folder Sheet::m_BON_Project_Root_Folder = BON::Folder(); // important: clear its content upon destruction
  Sheet::Sheet()
  	: m_projName(""),
--- 10,16 ----
  
  Sheet * Sheet::m_theOnlyInstance = 0;
! /*static*/ BON::Folder				Sheet::m_BON_Project_Root_Folder = BON::Folder();	// important: clear its content upon destruction
! /*static*/ std::set<BON::Model>		Sheet::m_setOfParadigmSheets;						// do the same as above
! 
  Sheet::Sheet()
  	: m_projName(""),
***************
*** 105,108 ****
--- 107,111 ----
  	m_attributeList.clear();
  	Sheet::m_BON_Project_Root_Folder = BON::Folder();
+ 	Sheet::m_setOfParadigmSheets.clear();
  }
  

Index: Sheet.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Sheet.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Sheet.h	30 Jul 2004 20:21:05 -0000	1.8
--- Sheet.h	21 Oct 2004 02:04:34 -0000	1.9
***************
*** 53,56 ****
--- 53,58 ----
  	static BON::Folder m_BON_Project_Root_Folder;
  
+ 	static std::set<BON::Model> m_setOfParadigmSheets;
+ 
  protected:
  	std::vector< FCO *> Sheet::sortBasedOnLevels();



More information about the GME-commit mailing list