Esempio n. 1
0
QString Package :: getInstalledPackageName()
{
    if ( localPackage )
        return localPackage->getPackageName();
    else
        return getPackageName();
}
Esempio n. 2
0
/*
 * Initialization function of req extension module which is automatically invoked
 * by SBMLExtensionRegister class before main() function invoked. 
 */
void
ReqExtension::init()
{
  //----------------------------------------------------------------
  //
  // 1. Check if the req package has already been registered
  //
  //----------------------------------------------------------------

  if (SBMLExtensionRegistry::getInstance().isRegistered(getPackageName()))
  {
    // do nothing
     return;
  }

  //----------------------------------------------------------------
  //
  // 2. Creates an SBMLExtension derived object
  //
  //----------------------------------------------------------------

  ReqExtension reqExtension;

  //----------------------------------------------------------------
  //
  // 3. Creates the SBasePlugins required by this package
  //
  //----------------------------------------------------------------

  std::vector<std::string> packageURIs;
  packageURIs.push_back(getXmlnsL3V1V1());

  SBaseExtensionPoint sbmldocExtPoint("core", SBML_DOCUMENT);
  SBaseExtensionPoint sbaseExtPoint("all", SBML_GENERIC_SBASE);

  SBasePluginCreator<ReqSBMLDocumentPlugin, ReqExtension> sbmldocPluginCreator(sbmldocExtPoint, packageURIs);
  SBasePluginCreator<ReqSBasePlugin, ReqExtension> sbasePluginCreator(sbaseExtPoint, packageURIs);

  //----------------------------------------------------------------
  //
  // 4. Adds the creator objects to the extension
  //
  //----------------------------------------------------------------

  reqExtension.addSBasePluginCreator(&sbmldocPluginCreator);
  reqExtension.addSBasePluginCreator(&sbasePluginCreator);

  //----------------------------------------------------------------
  //
  // 5. Register the object with the registry
  //
  //----------------------------------------------------------------

  int result = SBMLExtensionRegistry::getInstance().addExtension(&reqExtension);

  if (result != LIBSBML_OPERATION_SUCCESS)
  {
    std::cerr << "[Error] ReqExtension::init() failed." << std::endl;
  }
}
Esempio n. 3
0
extern void confirmPackageNameonDisk(void) {
	int exists, handle, ret;
	char filePkg[PATH_LENGTH],filePattern[PATH_LENGTH];
	char sysPath[PATH_LENGTH];	
	struct f_info file_info;
	
//	if (!SNexists())
//		return; // no serial number - don't write to disk
	if (SYSTEM_PATH)
		strcpy(sysPath,SYSTEM_PATH);
	else 
		strcpy(sysPath,DEFAULT_SYSTEM_PATH);
	strcpy(filePkg,sysPath);
	strcat(filePkg, (char *)getPackageName());
	strcat(filePkg, (char *)PACKAGE_EXT);
	exists = fileExists((LPSTR) filePkg);
	if (!exists) {
		mkdir((LPSTR)sysPath);
		tbChdir((LPSTR)sysPath);
		strcpy(filePattern,(char *)"*" PACKAGE_EXT);
		ret =_findfirst((LPSTR)filePattern, &file_info, D_FILE);
		while (ret >= 0) { 			
			ret = unlink((LPSTR)file_info.f_name);
			ret = _findnext(&file_info);
		}
		handle = tbOpen((LPSTR)filePkg,O_CREAT|O_RDWR|O_TRUNC);
		close(handle);
	}
}
void 
	TestExtension::init()
{
	if (SBMLExtensionRegistry::getInstance().isRegistered(getPackageName()))
	{
		return;
	}

	TestExtension testExtension;

	std::vector<std::string> packageURIs;
	packageURIs.push_back(getXmlnsL3V1V1());

	SBaseExtensionPoint sbmldocExtPoint("core",SBML_DOCUMENT);
	SBaseExtensionPoint modelExtPoint("core",SBML_MODEL);

	SBasePluginCreator<SBMLDocumentPlugin, TestExtension> sbmldocPluginCreator(sbmldocExtPoint,packageURIs);
	SBasePluginCreator<TestModelPlugin,   TestExtension> modelPluginCreator(modelExtPoint,packageURIs);

	testExtension.addSBasePluginCreator(&sbmldocPluginCreator);
	testExtension.addSBasePluginCreator(&modelPluginCreator);

	int result = SBMLExtensionRegistry::getInstance().addExtension(&testExtension);

	if (result != LIBSBML_OPERATION_SUCCESS)
	{
		std::cerr << "[Error] TestExtension::init() failed." << std::endl;
	}
}
Esempio n. 5
0
string CCUtils::getAppVersion() {
    // get context
    jobject ctx = CCUtilsAndroid::getContext();
    
    // get package manager
    JniMethodInfo t;
    JniHelper::getMethodInfo(t, "android/content/Context", "getPackageManager", "()Landroid/content/pm/PackageManager;");
	jobject packageManager = t.env->CallObjectMethod(ctx, t.methodID);
    
    // release
    t.env->DeleteLocalRef(t.classID);
    
    // get package info
    JniHelper::getMethodInfo(t, "android/content/pm/PackageManager", "getPackageInfo", "(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;");
    string pn = getPackageName();
    jstring jPN = t.env->NewStringUTF(pn.c_str());
	jobject packageInfo = t.env->CallObjectMethod(packageManager, t.methodID, jPN, 0);
    
    // get version
    jclass piClass = t.env->GetObjectClass(packageInfo);
    jstring jVer = (jstring)t.env->GetObjectField(packageInfo, t.env->GetFieldID(piClass, "versionName", "Ljava/lang/String;"));
    string ver = JniHelper::jstring2string(jVer);
                                           
    // release
    t.env->DeleteLocalRef(ctx);
    t.env->DeleteLocalRef(packageManager);
    t.env->DeleteLocalRef(packageInfo);
    t.env->DeleteLocalRef(piClass);
    t.env->DeleteLocalRef(jVer);
    t.env->DeleteLocalRef(jPN);
    t.env->DeleteLocalRef(t.classID);
    
    return ver;
}
Esempio n. 6
0
QString Package :: toString()
{
    QString ret = QObject::tr( "Package - %1\n              version - %2" ).
                    arg( getPackageName() ).
                    arg( getVersion() );

    if ( localPackage )
        ret.append( QObject::tr( "\n              inst version - %1" ).arg( localPackage->getVersion() ) );


    return ret;
}
void 
CompSBasePlugin::logInvalidId(const std::string& attribute,
                              const std::string& wrongattribute)
{

  if (&attribute == NULL || &wrongattribute == NULL) return;
  bool knownelement = (getParentSBMLObject() == NULL);
  std::ostringstream msg;

  msg << "Setting the attribute '" << attribute << "' ";
  if (knownelement) {
    msg << "of a <" << getParentSBMLObject()->getElementName() << "> ";
  }
  msg << "in the " << getPackageName() 
      << " package (version " << getPackageVersion() << ") to '" << wrongattribute
      << "' is illegal:  the string is not a well-formed SId.";

  SBMLErrorLog* errlog = getErrorLog();
  if (errlog)
  {
    errlog->logError(NotSchemaConformant, getLevel(), getVersion(), msg.str());
  }
}
const std::string& 
LayoutExtension::getName() const
{
  return getPackageName();
}
// ******************************************************************************************
// Save package using default path
// ******************************************************************************************
bool ConfigurationFilesWidget::generatePackage()
{
  // Get path name
  std::string new_package_path = stack_path_->getPath();

  // Check that a valid stack package name has been given
  if( new_package_path.empty() )
  {
    QMessageBox::warning( this, "Error Generating", "No package path provided. Please choose a directory location to generate the MoveIt configuration files." );
    return false;
  }

  // Check setup assist deps
  if( !checkDependencies() )
    return false; // canceled

  // Check that all groups have components
  if( !noGroupsEmpty() )
    return false; // not ready

  // Trim whitespace from user input
  boost::trim( new_package_path );

  // Get the package name ---------------------------------------------------------------------------------
  new_package_name_ = getPackageName( new_package_path );

  const std::string setup_assistant_file = config_data_->appendPaths( new_package_path, ".setup_assistant" );

  // Make sure old package is correct package type and verify over write
  if( fs::is_directory( new_package_path ) && !fs::is_empty( new_package_path ) )
  {

    // Check if the old package is a setup assistant package. If it is not, quit
    if( ! fs::is_regular_file( setup_assistant_file ) )
    {
      QMessageBox::warning( this, "Incorrect Folder/Package",
                            QString("The chosen package location already exists but was not previously created using this MoveIt Setup Assistant. If this is a mistake, replace the missing file: ")
                            .append( setup_assistant_file.c_str() ) );
      return false;
    }

    // Confirm overwrite
    if( QMessageBox::question( this, "Confirm Package Update",
                               QString("Are you sure you want to overwrite this existing package with updated configurations?<br /><i>")
                               .append( new_package_path.c_str() )
                               .append( "</i>" ),
                               QMessageBox::Ok | QMessageBox::Cancel)
        == QMessageBox::Cancel )
    {
      return false; // abort
    }

  }
  else // this is a new package (but maybe the folder already exists)
  {
    // Create new directory ------------------------------------------------------------------
    try
    {
      fs::create_directory( new_package_path ) && !fs::is_directory( new_package_path );
    }
    catch( ... )
    {
      QMessageBox::critical( this, "Error Generating Files",
                             QString("Unable to create directory ").append( new_package_path.c_str() ) );
      return false;
    }
  }

  // Begin to create files and folders ----------------------------------------------------------------------
  std::string absolute_path;

  for (int i = 0; i < gen_files_.size(); ++i)
  {
    GenerateFile* file = &gen_files_[i];

    // Check if we should skip this file
    if( !file->generate_ )
    {
      continue;
    }

    // Create the absolute path
    absolute_path = config_data_->appendPaths( new_package_path, file->rel_path_ );
    ROS_DEBUG_STREAM("Creating file " << absolute_path );

    // Run the generate function
    if( !file->gen_func_(absolute_path) )
    {
      // Error occured
      QMessageBox::critical( this, "Error Generating File",
                             QString("Failed to generate folder or file: '")
                             .append( file->rel_path_.c_str() ).append("' at location:\n").append( absolute_path.c_str() ));
      return false;
    }
    updateProgress(); // Increment and update GUI
  }

  return true;
}
Esempio n. 10
0
const std::string&
GroupsExtension::getName() const
{
  return getPackageName();
}
Esempio n. 11
0
/*
 *
 * Initialization function of groups extension module which is automatically invoked 
 * by SBMLExtensionRegister class before main() function invoked.
 *
 */
void 
GroupsExtension::init()
{
  //-------------------------------------------------------------------------
  //
  // 1. Checks if the groups pacakge has already been registered.
  //
  //-------------------------------------------------------------------------

  if (SBMLExtensionRegistry::getInstance().isRegistered(getPackageName()))
  {
    // do nothing;
    return;
  }

  //-------------------------------------------------------------------------
  //
  // 2. Creates an SBMLExtension derived object.
  //
  //-------------------------------------------------------------------------

  GroupsExtension groupsExtension;

  //-------------------------------------------------------------------------------------
  //
  // 3. Creates SBasePluginCreatorBase derived objects required for this 
  //    extension. The derived classes can be instantiated by using the following 
  //     template class.
  //
  //    temaplate<class SBasePluginType> class SBasePluginCreator
  //
  //    The constructor of the creator class has two arguments:
  //
  //        (1) SBaseExtensionPoint : extension point to which the plugin object connected
  //        (2) std::vector<std::string> : a std::vector object that contains a list of URI
  //                                       (package versions) supported by the plugin object.
  //
  //    For example, two plugin objects (plugged in SBMLDocument and Model elements) are 
  //    required for the groups extension.
  //
  //    Since only 'required' attribute is used in SBMLDocument by the groups package, existing
  //    SBMLDocumentPluginNotRequired class can be used as-is for the plugin.
  //
  //    Since the lists of supported package versions (currently only L3V1-groups-V1 supported )
  //    are equal in the both plugin objects, the same vector object is given to each 
  //    constructor.
  //
  //---------------------------------------------------------------------------------------

  std::vector<std::string> packageURIs;
  packageURIs.push_back(getXmlnsL3V1V1());

  SBaseExtensionPoint sbmldocExtPoint("core",SBML_DOCUMENT);
  SBaseExtensionPoint modelExtPoint("core",SBML_MODEL);

  SBasePluginCreator<GroupsSBMLDocumentPlugin, GroupsExtension> sbmldocPluginCreator(sbmldocExtPoint, packageURIs);
  SBasePluginCreator<GroupsModelPlugin,   GroupsExtension> modelPluginCreator(modelExtPoint,packageURIs);

  //--------------------------------------------------------------------------------------
  //
  // 3. Adds the above SBasePluginCreatorBase derived objects to the SBMLExtension derived object.
  //
  //--------------------------------------------------------------------------------------

  groupsExtension.addSBasePluginCreator(&sbmldocPluginCreator);
  groupsExtension.addSBasePluginCreator(&modelPluginCreator);

  //-------------------------------------------------------------------------
  //
  // 4. Registers the SBMLExtension derived object to SBMLExtensionRegistry
  //
  //-------------------------------------------------------------------------

  int result = SBMLExtensionRegistry::getInstance().addExtension(&groupsExtension);

  if (result != LIBSBML_OPERATION_SUCCESS)
  {
    std::cerr << "[Error] GroupsExtension::init() failed." << std::endl;
  }
}
Esempio n. 12
0
/*
 * Initialization function of multi extension module which is automatically invoked
 * by SBMLExtensionRegister class before main() function invoked. 
 */
void
MultiExtension::init()
{
  //----------------------------------------------------------------
  //
  // 1. Check if the multi package has already been registered
  //
  //----------------------------------------------------------------

  if (SBMLExtensionRegistry::getInstance().isRegistered(getPackageName()))
  {
    // do nothing
     return;
  }

  //----------------------------------------------------------------
  //
  // 2. Creates an SBMLExtension derived object
  //
  //----------------------------------------------------------------

  MultiExtension multiExtension;

  //----------------------------------------------------------------
  //
  // 3. Creates the SBasePlugins required by this package
  //
  //----------------------------------------------------------------

  std::vector<std::string> packageURIs;
  packageURIs.push_back(getXmlnsL3V1V1());

  SBaseExtensionPoint sbmldocExtPoint("core", SBML_DOCUMENT);
  SBaseExtensionPoint modelExtPoint("core", SBML_MODEL);
  SBaseExtensionPoint compartmentExtPoint("core", SBML_COMPARTMENT);
  SBaseExtensionPoint speciesExtPoint("core", SBML_SPECIES);
  SBaseExtensionPoint reactionExtPoint("core", SBML_REACTION);
  SBaseExtensionPoint simplespeciesreferenceExtPoint("core", SBML_MODIFIER_SPECIES_REFERENCE);
  SBaseExtensionPoint speciesreferenceExtPoint("core", SBML_SPECIES_REFERENCE);

  SBasePluginCreator<MultiSBMLDocumentPlugin, MultiExtension> sbmldocPluginCreator(sbmldocExtPoint, packageURIs);
  SBasePluginCreator<MultiModelPlugin, MultiExtension> modelPluginCreator(modelExtPoint, packageURIs);
  SBasePluginCreator<MultiCompartmentPlugin, MultiExtension> compartmentPluginCreator(compartmentExtPoint, packageURIs);
  SBasePluginCreator<MultiSpeciesPlugin, MultiExtension> speciesPluginCreator(speciesExtPoint, packageURIs);
  SBasePluginCreator<MultiReactionPlugin, MultiExtension> reactionPluginCreator(reactionExtPoint, packageURIs);
  SBasePluginCreator<MultiSimpleSpeciesReferencePlugin, MultiExtension> simplespeciesreferencePluginCreator(simplespeciesreferenceExtPoint, packageURIs);
  SBasePluginCreator<MultiSpeciesReferencePlugin, MultiExtension> speciesreferencePluginCreator(speciesreferenceExtPoint, packageURIs);

  //----------------------------------------------------------------
  //
  // 4. Adds the creator objects to the extension
  //
  //----------------------------------------------------------------

  multiExtension.addSBasePluginCreator(&sbmldocPluginCreator);
  multiExtension.addSBasePluginCreator(&modelPluginCreator);
  multiExtension.addSBasePluginCreator(&compartmentPluginCreator);
  multiExtension.addSBasePluginCreator(&speciesPluginCreator);
  multiExtension.addSBasePluginCreator(&reactionPluginCreator);
  multiExtension.addSBasePluginCreator(&simplespeciesreferencePluginCreator);
  multiExtension.addSBasePluginCreator(&speciesreferencePluginCreator);
  multiExtension.setASTBasePlugin(new MultiASTPlugin(getXmlnsL3V1V1()));

  //----------------------------------------------------------------
  //
  // 5. Register the object with the registry
  //
  //----------------------------------------------------------------

  int result = SBMLExtensionRegistry::getInstance().addExtension(&multiExtension);

  if (result != LIBSBML_OPERATION_SUCCESS)
  {
    std::cerr << "[Error] MultiExtension::init() failed." << std::endl;
  }
}
Esempio n. 13
0
void setPaths() {
	const std::string externalSDList[] = {
		"/mnt/extSdCard/Android",
		"/storage/extSdCard/Android"
		};
	const int externalSDList_size = 2;

	PATH_CONF = std::string(SDL_AndroidGetInternalStoragePath()) + "/config";

	const std::string package_name = getPackageName();
	const std::string user_folder = "data/" + package_name + "/files";

	if (SDL_AndroidGetExternalStorageState() != 0)
	{
		PATH_USER = std::string(SDL_AndroidGetExternalStoragePath());
	}
	// NOTE: Next condition shouldn't be needed, but in theory SDL_AndroidGetExternalStoragePath() can fail.
	else
	{
		const std::string internalSDList[] = {
			"/sdcard/Android",
			"/mnt/sdcard/Android",
			"/storage/sdcard0/Android",
			"/storage/emulated/0/Android",
			"/storage/emulated/legacy/Android",
			};
		const int internalSDList_size = 5;

		for (int i = 0; i < internalSDList_size; i++)
		{
			if (dirExists(internalSDList[i]))
			{
				PATH_USER = internalSDList[i] + "/" + user_folder;
				break;
			}
		}
	}
	if (PATH_USER.empty())
	{
		logError("Settings: Android external storage unavailable: %s", SDL_GetError());
	}

	for (int i = 0; i < externalSDList_size; i++)
	{
		if (dirExists(externalSDList[i]))
		{
			PATH_DATA = externalSDList[i] + "/" + user_folder;
			if (!dirExists(PATH_DATA))
			{
				createDir(externalSDList[i] + "/data" + package_name);
				createDir(externalSDList[i] + "/data" + package_name + "/files");
			}
			break;
		}
	}

	PATH_USER += "/userdata";

	createDir(PATH_CONF);
	createDir(PATH_USER);
	createDir(PATH_USER + "/mods");
	createDir(PATH_USER + "/saves");

	PATH_CONF += "/";
	PATH_USER += "/";
	PATH_DATA += "/";
}
Esempio n. 14
0
/*
 *
 * Initialization function of groups extension module which is automatically invoked 
 * by SBMLExtensionRegister class before main() function invoked.
 *
 */
void 
RenderExtension::init()
{
  //-------------------------------------------------------------------------
  //
  // 1. Checks if the groups pacakge has already been registered.
  //
  //-------------------------------------------------------------------------

  if (SBMLExtensionRegistry::getInstance().isRegistered(getPackageName()))
  {
    // do nothing;
    return;
  }

  //-------------------------------------------------------------------------
  //
  // 2. Creates an SBMLExtension derived object.
  //
  //-------------------------------------------------------------------------

  RenderExtension renderExtension;

  //-------------------------------------------------------------------------------------
  //
  // 3. Creates SBasePluginCreatorBase derived objects required for this 
  //    extension. The derived classes can be instantiated by using the following 
  //     template class.
  //
  //    temaplate<class SBasePluginType> class SBasePluginCreator
  //
  //    The constructor of the creator class has two arguments:
  //
  //        (1) SBaseExtensionPoint : extension point to which the plugin object connected
  //        (2) std::vector<std::string> : a std::vector object that contains a list of URI
  //                                       (package versions) supported by the plugin object.
  //
  //    For example, two plugin objects (plugged in SBMLDocument and Model elements) are 
  //    required for the groups extension.
  //
  //    Since only 'required' attribute is used in SBMLDocument by the groups package, existing
  //    SBMLDocumentPluginNotRequired class can be used as-is for the plugin.
  //
  //    Since the lists of supported package versions (currently only L3V1-groups-V1 supported )
  //    are equal in the both plugin objects, the same vector object is given to each 
  //    constructor.
  //
  //---------------------------------------------------------------------------------------

  std::vector<std::string> packageURIs;
  packageURIs.push_back(getXmlnsL3V1V1());
  packageURIs.push_back(getXmlnsL2());  

  // 
  // LayoutSpeciesReferencePlugin is used only for SBML Level 2
  //
  std::vector<std::string> L2packageURI;
  L2packageURI.push_back(getXmlnsL2());  

  SBaseExtensionPoint sbmldocExtPoint("core",SBML_DOCUMENT);
  SBaseExtensionPoint layoutExtPoint("layout",SBML_LAYOUT_LAYOUT);
  SBaseExtensionPoint layoutGOExtPoint("layout",SBML_LAYOUT_GRAPHICALOBJECT);
  SBaseExtensionPoint clayoutExtPoint("core",SBML_LAYOUT_LAYOUT);
  SBaseExtensionPoint listOfLayoutsExtPoint("layout", SBML_LIST_OF);

  SBasePluginCreator<RenderSBMLDocumentPlugin, RenderExtension> sbmldocPluginCreator(sbmldocExtPoint,packageURIs);
  SBasePluginCreator<RenderLayoutPlugin,   RenderExtension> layoutPluginCreator(layoutExtPoint,packageURIs);
  SBasePluginCreator<RenderLayoutPlugin,   RenderExtension> clayoutPluginCreator(clayoutExtPoint,packageURIs);
  SBasePluginCreator<RenderListOfLayoutsPlugin,   RenderExtension> lolPluginCreator(listOfLayoutsExtPoint,packageURIs);
  SBasePluginCreator<RenderGraphicalObjectPlugin,   RenderExtension> goPluginCreator(layoutGOExtPoint,packageURIs);

  //--------------------------------------------------------------------------------------
  //
  // 3. Adds the above SBasePluginCreatorBase derived objects to the SBMLExtension derived object.
  //
  //--------------------------------------------------------------------------------------

  renderExtension.addSBasePluginCreator(&sbmldocPluginCreator);
  renderExtension.addSBasePluginCreator(&layoutPluginCreator);
  renderExtension.addSBasePluginCreator(&clayoutPluginCreator);
  renderExtension.addSBasePluginCreator(&lolPluginCreator);
  renderExtension.addSBasePluginCreator(&goPluginCreator);
  
  //-------------------------------------------------------------------------
  //
  // 4. Registers the SBMLExtension derived object to SBMLExtensionRegistry
  //
  //-------------------------------------------------------------------------

  int result = SBMLExtensionRegistry::getInstance().addExtension(&renderExtension);

  if (result != LIBSBML_OPERATION_SUCCESS)
  {
    std::cerr << "[Error] RenderExtension::init() failed." << std::endl;
  }

  // add converter to registry;
  RenderLayoutConverter rlc;
  SBMLConverterRegistry::getInstance().addConverter(&rlc);
}
Esempio n. 15
0
/*
 *
 * Initialization function of layout extension module which is automatically invoked 
 * by SBMLExtensionRegister class before main() function invoked.
 *
 */
void 
LayoutExtension::init()
{
  //-------------------------------------------------------------------------
  //
  // 1. Checks if the layout package has already been registered.
  //
  //-------------------------------------------------------------------------

  if (SBMLExtensionRegistry::getInstance().isRegistered(getPackageName()))
  {
    // do nothing;
    return;
  }

  //-------------------------------------------------------------------------
  //
  // 2. Creates an SBMLExtension derived object.
  //
  //-------------------------------------------------------------------------

  LayoutExtension layoutExtension;

  //-------------------------------------------------------------------------------------
  //
  // 3. Creates SBasePluginCreatorBase derived objects required for this extension. 
  //    The derived classes can be instantiated by using the following template class.
  //
  //    temaplate<class SBasePluginType> class SBasePluginCreator
  //
  //    The constructor of the creator class has two arguments:
  //
  //        (1) SBaseExtensionPoint : extension point to which the plugin object connected
  //        (2) std::vector<std::string> : a std::vector object that contains a list of URI
  //                                       (package versions) supported by the plugin object.
  //
  //    For example, three plugin classes (plugged in SBMLDocument, Model, and SpeciesReference) 
  //    are required for the layout extension (The plugin class for SpeciesReference is required
  //    only for SBML Level 2) .
  //
  //---------------------------------------------------------------------------------------

  std::vector<std::string> packageURIs;
  packageURIs.push_back(getXmlnsL3V1V1());
  packageURIs.push_back(getXmlnsL2());  

  // 
  // LayoutSpeciesReferencePlugin is used only for SBML Level 2
  //
  std::vector<std::string> L2packageURI;
  L2packageURI.push_back(getXmlnsL2());  

  SBaseExtensionPoint sbmldocExtPoint("core",SBML_DOCUMENT);
  SBaseExtensionPoint modelExtPoint("core",SBML_MODEL);
  SBaseExtensionPoint sprExtPoint("core",SBML_SPECIES_REFERENCE);
  SBaseExtensionPoint msprExtPoint("core",SBML_MODIFIER_SPECIES_REFERENCE);

	SBasePluginCreator<LayoutSBMLDocumentPlugin, LayoutExtension> sbmldocPluginCreator(sbmldocExtPoint, packageURIs);
  SBasePluginCreator<LayoutModelPlugin,  LayoutExtension>           modelPluginCreator(modelExtPoint,packageURIs);
  SBasePluginCreator<LayoutSpeciesReferencePlugin, LayoutExtension> sprPluginCreator(sprExtPoint,L2packageURI);
  SBasePluginCreator<LayoutSpeciesReferencePlugin, LayoutExtension> msprPluginCreator(msprExtPoint,L2packageURI);

  //------------------------------------------------------------------------------------------
  //
  // 4. Adds the above SBasePluginCreatorBase derived objects to the SBMLExtension derived object.
  //
  //------------------------------------------------------------------------------------------

  layoutExtension.addSBasePluginCreator(&sbmldocPluginCreator);
  layoutExtension.addSBasePluginCreator(&modelPluginCreator);
  layoutExtension.addSBasePluginCreator(&sprPluginCreator);
  layoutExtension.addSBasePluginCreator(&msprPluginCreator);

  //-------------------------------------------------------------------------
  //
  // 5. Registers the SBMLExtension derived object to SBMLExtensionRegistry
  //
  //-------------------------------------------------------------------------

  int result = SBMLExtensionRegistry::getInstance().addExtension(&layoutExtension);

  if (result != LIBSBML_OPERATION_SUCCESS)
  {
    std::cerr << "[Error] LayoutExtension::init() failed." << std::endl;
  }
}
/*
 * Returns the name of this package
 */
const std::string&
SpatialExtension::getName() const
{
  return getPackageName();
}
Esempio n. 17
0
/*
 * Returns the name of this package
 */
const std::string&
DistribExtension::getName() const
{
    return getPackageName();
}
/*
 * Initialization function of spatial extension module which is automatically invoked
 * by SBMLExtensionRegister class before main() function invoked. 
 */
void
SpatialExtension::init()
{
  //----------------------------------------------------------------
  //
  // 1. Check if the spatial package has already been registered
  //
  //----------------------------------------------------------------

  if (SBMLExtensionRegistry::getInstance().isRegistered(getPackageName()))
  {
    // do nothing
     return;
  }

  //----------------------------------------------------------------
  //
  // 2. Creates an SBMLExtension derived object
  //
  //----------------------------------------------------------------

  SpatialExtension spatialExtension;

  //----------------------------------------------------------------
  //
  // 3. Creates the SBasePlugins required by this package
  //
  //----------------------------------------------------------------

  std::vector<std::string> packageURIs;
  packageURIs.push_back(getXmlnsL3V1V1());

  SBaseExtensionPoint sbmldocExtPoint("core", SBML_DOCUMENT);
  SBaseExtensionPoint modelExtPoint("core", SBML_MODEL);
  SBaseExtensionPoint compartmentExtPoint("core", SBML_COMPARTMENT);
  SBaseExtensionPoint speciesExtPoint("core", SBML_SPECIES);
  SBaseExtensionPoint parameterExtPoint("core", SBML_PARAMETER);
  SBaseExtensionPoint reactionExtPoint("core", SBML_REACTION);

  SBasePluginCreator<SpatialSBMLDocumentPlugin, SpatialExtension> sbmldocPluginCreator(sbmldocExtPoint, packageURIs);
  SBasePluginCreator<SpatialModelPlugin, SpatialExtension> modelPluginCreator(modelExtPoint, packageURIs);
  SBasePluginCreator<SpatialCompartmentPlugin, SpatialExtension> compartmentPluginCreator(compartmentExtPoint, packageURIs);
  SBasePluginCreator<SpatialSpeciesPlugin, SpatialExtension> speciesPluginCreator(speciesExtPoint, packageURIs);
  SBasePluginCreator<SpatialParameterPlugin, SpatialExtension> parameterPluginCreator(parameterExtPoint, packageURIs);
  SBasePluginCreator<SpatialReactionPlugin, SpatialExtension> reactionPluginCreator(reactionExtPoint, packageURIs);

  //----------------------------------------------------------------
  //
  // 4. Adds the creator objects to the extension
  //
  //----------------------------------------------------------------

  spatialExtension.addSBasePluginCreator(&sbmldocPluginCreator);
  spatialExtension.addSBasePluginCreator(&modelPluginCreator);
  spatialExtension.addSBasePluginCreator(&compartmentPluginCreator);
  spatialExtension.addSBasePluginCreator(&speciesPluginCreator);
  spatialExtension.addSBasePluginCreator(&parameterPluginCreator);
  spatialExtension.addSBasePluginCreator(&reactionPluginCreator);

  //----------------------------------------------------------------
  //
  // 5. Register the object with the registry
  //
  //----------------------------------------------------------------

  int result = SBMLExtensionRegistry::getInstance().addExtension(&spatialExtension);

  if (result != LIBSBML_OPERATION_SUCCESS)
  {
    std::cerr << "[Error] SpatialExtension::init() failed." << std::endl;
  }
}
Esempio n. 19
0
/*
 * Returns the name of this package
 */
const std::string&
MultiExtension::getName() const
{
  return getPackageName();
}
Esempio n. 20
0
const std::string&
RenderExtension::getName() const
{
  return getPackageName();
}