#include <mxmodularMX/mxmConfigSection.h>
Inheritance diagram for mxmConfigSection:
Public Member Functions | |
void | setName (const mxmString §ion_name) |
Renames the config section. | |
void | setOwner (const mxmString §ion_owner) |
Sets owner of the config section. | |
void | setInternalMode (bool enable) |
Specifies whether or not the config section is an internal one (alternate directory in filesystem). | |
bool | load (const mxmStringList &config_section_file, const char **profile_type_ids=0, bool allow_multi_line=false) |
Loads the config section from a string list holding a config section file in memory. | |
void | clear () |
Deletes all key/value pairs, those in profiles as well as the direct ones. | |
void | purgeValueCharacters (const mxmString &key, const mxmString &characters_to_purge) |
In all profiles, and in the config section's set of own direct keys, this method visits all key/value pairs mathing the key specified, and removes from their value strings the specified characters. | |
void | dump (std::FILE *outfile=stdout) |
For testing purposes. | |
mxmString & | operator[] (const mxmString &key) |
Returns a reference to the value for one of the config section's own keys. | |
mxmPerlStyleHash & | getKeys (void) |
Returns a reference to the list of key / value pairs (w/o profile data). | |
mxmPerlStyleHash & | profile (const mxmString &profile_type_id, const mxmString &profile_name) |
The profile and respective profile set are transparently created if not already present. | |
mxmPerlStyleHash & | profile (const mxmString &profile_type_id, int const profile_index, mxmString &profile_name) const |
Returns the profile referenced through profile_type_id and profile_index (starting with 0). | |
mxmPerlStyleHash * | lookupProfile (const mxmString &profile_type_id, const mxmString &profile_name) const |
Returns the specified profile stored in the config section, or 0 in case such is not present. | |
mxm::smart< mxmStringList > | enumerateProfiles (const mxmString &profile_type_id) |
Returns the list of currently present profiles for the given profile type. | |
void | deleteProfile (const mxmString &profile_type_id, const mxmString &profile_name) |
Removes the specified profile if present. | |
bool | renameProfile (mxmString const &profile_type_id, mxmString const &profile_name_old, mxmString const &profile_name_new) |
Rename the specified profile if present and return true on success. | |
int | profileSetSize (const mxmString &profile_type_id, mxmList::Iterator *profile_iterator=0) const |
Returns the number of profiles in the specified profile set, or -1 if the set is not present. | |
void | deleteProfileSet (const mxmString &profile_type_id) |
Removes the profile set for the specified profile type (if present). | |
void | moveProfileToTop (const mxmString &profile_type_id, const mxmString &profile_name) |
Move the specified profile to the beginning of its profile set. | |
Static Public Attributes | |
static const char * | LegacyProfileStringKey = "_legacy_profile_string_" |
static const char * | WhitespaceCharacters = mxm::WhitespaceCharacters |
Format Style Flags | |
When saving the configuration to a file using save(), you can control the format and have various information written to the configuration file as comments. These flags describe how control the configuration file format. | |
static const mxm::flags | HeaderTrailerNone = 1 |
No comments. | |
static const mxm::flags | HeaderLibBuildDate = 2 |
Library build date. | |
static const mxm::flags | HeaderSectionName = 4 |
Section name, set with setName() or with constructor mxmConfigSection(). | |
static const mxm::flags | HeaderSectionOwner = 8 |
Section owner, set with setOwner(). | |
static const mxm::flags | HeaderTimestamp = 16 |
Time of writing of configuration file. | |
static const mxm::flags | TrailerProfileSummary = 32 |
Internal debugging data. | |
static const mxm::flags | SingleLineProfiles = 64 |
Write Profiles in single lines (instead of multiple, which is the default). | |
Private Member Functions | |
ProfileSet & | profileSet (const mxmString &type_id) |
This method adds the profile set if not already present. | |
ProfileSet * | lookupProfileSet (const mxmString &type_id, mxmList::Iterator *profile_set_iterator=0) const |
Private helper method, returns 0 if the profile set is not present. | |
void | announceChange (void) |
Announces change to the config section in a system-wide fashion. | |
Private Attributes | |
mxmString | SectionName |
mxmString | SectionOwner |
mxmPerlStyleHash | OwnKeys |
mxmList | ProfileSets |
bool | CaseInsensitiveKeys |
bool | IsInternal |
void * | StableABIDataExtension |
Classes | |
class | Profile |
Represents a single profile within a config section. More... | |
class | ProfileSet |
In order to be able to read in and process MX
camera configuration files from a C++
application, a convenient and sufficiently comfortable mechanism was needed. This class is it.
The class was also introduced to work towards a unification of configuration file format and access. Sadly, as of May 08, 2006, there are numerous variants of configuration file formats in use on MX
cameras. As a result, the class' parser was designed to be configurable, so that it can actually deal with most of them. However, it is most desirable to have a unified file format for camera configuration, so maybe we will continually switch the older files to the new, unified format.
Configuration File Structure
The abstract conceptional structure of the camera configuration file is as follows.
/etc/config
. There is an alternate path of /var/lib/config
, where so-called internal config sections are stored that share the same file format (eclecticism) but serve dynamic communications purposes between camera services. To access the latter, the class can be switched to internal mode via setInternalMode().
[khe]
Kai Hergenroether
|
Announces change to the config section in a system-wide fashion. If the config section is an internal one, the method does nothing. |
|
For testing purposes.
Prints out the current config section RAM image (to |
|
Loads the config section from a string list holding a config section file in memory.
If
If
|
|
Returns the specified profile stored in the config section, or The config section retains ownership over the profile. |
|
Returns a reference to the value for one of the config section's own keys.
If returned string is Simply relays the call to the repective operator of the encapsuled mxmPerlStyleHash holding the config section's own keys. Consult that operator's documetnation for details. |
|
Returns the profile referenced through profile_type_id and profile_index (starting with 0). The name of the profile found is stored in profile_name. |
|
Returns the number of profiles in the specified profile set, or
In case the profile set is present, and |
|
Specifies whether or not the config section is an internal one (alternate directory in filesystem).
Internal mode defaults to Only affects generation of correct path to configfile. |
|
Sets owner of the config section. The owner of the configuration section. Can be written to the configuration file when appropriate HeaderTrailer flags are passed into save(). |