Click here to Skip to main content
15,886,199 members
Articles / Programming Languages / C++

Remote SOF - An OSGI-like modularization framework for C++ supporting distributed software modules

Rate me:
Please Sign up or sign in to vote.
4.58/5 (8 votes)
13 Jul 2009BSD10 min read 31.3K   15  
The article describes the usage of a modularization framework called Remote SOF supporting distributed software modules.
#ifndef PROPERTIES_H
#define PROPERTIES_H

#include <map>
#include <string>

namespace sof { namespace framework {

using namespace std;

/**
 * The <code>Properties</code> object describes a service
 * object. Each property entry in the <code>Properties</code>
 * object consists of a key/value pair.
 * When a service is registered with the framework
 * the service object is specified by the class name and a
 * <code>Properties</code> object. This allows to register
 * several service object of the same type (class name) but
 * with different properties.<br>
 * So the service listeners are able to distinguish between
 * service objects of the same type by using the provided
 * properties.
 *
 * @author magr74
 */
class Properties
{
	private:

		/**
		 * The internal storage of the properties.
		 */
		map<string,string> mapper;

	public:

		/**
		 * Stores a property entry.
		 *
		 * @param key
		 *			The identifier of the property.
		 *
		 * @param value
		 *			The value of the property.
		 */
		void put( const string &key, const string &value );

		/**
		 * Retrieves (not removing) a property value.
		 *
		 * @param key
		 *			The key of the property.
		 *
		 * @return
		 *			The property value relating to the key.
		 */
		string get( const string &key );

		/**
		 * Returns a string representation of the properties
		 * object.
		 *
		 * @return
		 *			A string containing all key/value pairs in
		 *			a readable form.
		 */
		string toString() const;

		/**
		 * Compares this property object with a
		 * specified object.
		 */
		bool operator==( const Properties& props );

		/**
		 * Returns the number of entries in the 
		 * <code>Properties</code> object.
		 */
		int getSize() const;

		/**
		 * Returns an iterator for the internal map structure.
		 *
		 * @return
		 *		The iterator instance.
		 */
		map<string,string>::const_iterator begin() const;

		/**
		 * Returns an iterator for the internal map structure.
		 *
		 * @return
		 *		The iterator instance.
		 */
		map<string,string>::const_iterator end() const;

};

}}
#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The BSD License


Written By
Software Developer
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions