Click here to Skip to main content
15,886,776 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 IBUNDLE_CONTEXT_H
#define IBUNDLE_CONTEXT_H

#include <string>

#include "IService.h"
#include "Properties.h"
#include "IServiceListener.h"
#include "IServiceRegistration.h"

namespace sof { namespace framework {

using namespace std;

using namespace sof::framework;

/**
 * When the framework starts or stops a bundle (calling <code>start</code> or
 * <code>stop</code> of the <code>BundleActivator</code>) a bundle context object
 * is passed. This <code>IBundleContext</code> object provides methods for registering
 * services, service listeners etc.<br>
 * It represents a means for the software bundle developer in order to communicate with
 * the framework.
 *
 * @author magr74
 */
class IBundleContext
{
	public:

		/**
		 * Type definition for a constant pointer.
		 */
		typedef IBundleContext* const ConstPtr;

		/**
		 * Desctructor which is called when object is deleted.
		 */
		virtual ~IBundleContext() {};

		/**
		 * Registers a service with the SOF framework. Bundles which track this service
		 * are notified as soon as this service is registered.
		 *
		 * @param className
		 *				The class name of the service which is registered.
		 * @param service
		 *				The pointer to the service object.         		 
		 * @param dict
		 *				The properties object which describes the service object.
		 * @return 
		 *				Returns an object of type <code>IServiceRegistration</code> which provides
		 *				a method for unregistering the service object.
		 *
		 */
		virtual IServiceRegistration* registerService( const string &className, IService::ConstPtr service, const Properties &dict ) = 0;

		/**
         * Adds a service listener object to the framework. The service listener is notified when the service
		 * object (the service listener listens for) is registered.
		 * 
		 * @param serviceListener
		 *					The pointer to the service listener object.
		 * @param serviceName
		 *					The name of the service the listener listens for.
		 */
		virtual void addServiceListener( IServiceListener::ConstPtr serviceListener, const string &serviceName ) = 0;

		/**
		 * Deregisters a service listener object.
		 *
		 * @param serviceListener
		 *				The pointer to the service listener object.
		 */
		virtual void removeServiceListener( IServiceListener::ConstPtr serviceListener ) = 0;
};

}}
#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