Matrix Science header
Public Member Functions

ms_databases Class Reference
[Mascot configuration files module]

An instance of this class represents the Databases section of mascot.dat. More...

#include <ms_databaseoptions.hpp>

Inheritance diagram for ms_databases:
Inheritance graph
[legend]
Collaboration diagram for ms_databases:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ms_databases ()
 Default constructor.
 ms_databases (const ms_databases &src)
 Copying constructor.
 ~ms_databases ()
 Destructor.
void appendDatabase (const ms_databaseoptions *item)
 Add one more database definition at the end of the list.
void clearDatabases ()
 Deletes all database definitions.
void copyFrom (const ms_databases *right)
 Can be used to create a copy of another object.
void defaultValues ()
 Initialises the instance with default values.
bool deleteDatabaseByName (const char *name)
 Remove a database from the list in memory.
bool deleteDatabaseByNumber (const int num)
 Remove a database from the list in memory.
int findDatabase (const char *dbName, const bool searchInactive=false) const
 Finds a database with the specified name and returns its number to access.
const ms_databaseoptionsgetDatabase (const int index) const
 Returns a database definition by its number.
int getNumberOfDatabases () const
 Returns the total number of database definitions including inactive (commented out) databases.
std::string getPreceedingComments () const
 Returns any comments preceeding the section.
bool isSectionAvailable () const
 Check if the section has been actually read form the file or have to be saved.
ms_databasesoperator= (const ms_databases &right)
 Assignment operator for C++ client applications.
void setPreceedingComments (const std::string &comments)
 Sets any comments preceeding the section.
void setSectionAvailable (const bool value)
 Changes availability of the section, i.e. whether it should be saved in the file.
bool updateDatabaseByName (const char *name, const ms_databaseoptions db)
 Update the information for a specific database.
bool updateDatabaseByNumber (const int num, const ms_databaseoptions db)
 Update the information for a specific database.

Detailed Description

An instance of this class represents the Databases section of mascot.dat.

An instance is created and populated with database entries within ms_datfile class. It contains active database definitions as well as inactive ones. When traversing the list of database with getNumberOfDatabases() and getDatabase() members, don't forget to check each entry for being active. Otherwise one or all database parameters might be invalid and, therefore, must be ignored. In a text-based configuration file a database definition can be made inactive by commenting it out.

For detailed information on any of the options please consult Mascot manual.

Also get yourselves acquainted with the base class ms_customproperty. It facilitates the following tasks:

More functionality is described in details in the documentation for the class.

Examples:

config_mascotdat.cpp.


Member Function Documentation

void appendDatabase ( const ms_databaseoptions item )

Add one more database definition at the end of the list.

Parameters:
itemvalid pointer to a ms_databaseoptions object
bool deleteDatabaseByName ( const char *  name )

Remove a database from the list in memory.

If the database name is specified incorrectly FALSE value is returned and no action is performed.

Parameters:
namethe database name.
Returns:
TRUE if the database has been found and deleted and FALSE otherwise.
bool deleteDatabaseByNumber ( const int  num )

Remove a database from the list in memory.

If the database index is specified incorrectly FALSE value is returned and no action is performed.

Parameters:
numzero-based database index.
Returns:
TRUE if the database has been deleted and FALSE otherwise.
int findDatabase ( const char *  dbName,
const bool  searchInactive = false 
) const

Finds a database with the specified name and returns its number to access.

Note that only active database will be returned (unless searchInactive is set to TRUE). If no database have been found the returning value will be -1.

Parameters:
dbNamea database name to find.
searchInactiveset this parameter to TRUE if you want to search both active and inactive databases.
Returns:
the database index if found and -1 if not.
const ms_databaseoptions * getDatabase ( const int  index ) const

Returns a database definition by its number.

Use this member to retrieve a database definition with index from 0 to (getNumberOfDatabases()-1).

Parameters:
indexnumber of database to look for
Returns:
pointer to a ms_databaseoptions object
Examples:
config_mascotdat.cpp.
int getNumberOfDatabases (  ) const

Returns the total number of database definitions including inactive (commented out) databases.

By default the list of database is empty unless explicitly populated.

Returns:
Number of databases
Examples:
config_mascotdat.cpp.
std::string getPreceedingComments (  ) const [inherited]

Returns any comments preceeding the section.

Sections in the mascot.dat file may have comments preceeding them. In most cases, these comments need to stay 'attached' to the section.

Multiple line comments are supported by having a single string with newline characters

See also:
setPreceedingComments()
Returns:
any comments preceeding the section
void setPreceedingComments ( const std::string &  comments ) [inherited]

Sets any comments preceeding the section.

Sections in the mascot.dat file may have comments preceeding them. In most cases, these comments need to stay 'attached' to the section.

Multiple line comments are supported by having a single string with newline characters

See also:
getPreceedingComments()
Parameters:
commentsany comments preceeding the section
bool updateDatabaseByName ( const char *  name,
const ms_databaseoptions  db 
)

Update the information for a specific database.

If a database with the supplied name cannot be found no database will be updated and the returning value will be FALSE.

Parameters:
namea database name to find.
dba database object to copy the content from.
Returns:
TRUE if the database has been successfully found and updated and FALSE otherwise.
bool updateDatabaseByNumber ( const int  num,
const ms_databaseoptions  db 
)

Update the information for a specific database.

If the index is out of bounds no database will be updated and the returning value will be FALSE.

Parameters:
numa zero-based index of the database to update.
dba database object to copy the content from.
Returns:
TRUE if the database index indicates a valid database in the internal list and FALSE otherwise.

The documentation for this class was generated from the following files:
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:52