#include <acsncConsumer.h>
List of all members.
Detailed Description
Consumer implements a structured event push consumer interface from the CORBA notification service (NC). This class is an abstract base class due to the pure virtual function: push_structured_event(). Derived classes must implement this function plus any others which facilitate the consuming of data, for example, a callback function. The contructor of derived classes must also call the init() method (see the SimpleConsumer class for an example).
TODO:
- add a mutex for the polling thread???
- check for both local and remote memory leaks
Constructor & Destructor Documentation
nc::Consumer::Consumer |
( |
const char * |
channelName |
) |
|
Constructor to be used within components. Consumer will use the Container to get a reference to the Naming Service. If a valid reference to the container cannot be obtained, Consumer will default to creating it's own ORB (assuming Consumer is run on the same host as the Naming Service).
- Parameters:
-
| channelName | name of the channel to connect to. |
nc::Consumer::Consumer |
( |
const char * |
channelName, |
|
|
CORBA::ORB_ptr |
orb_mp | |
|
) |
| | |
Constructor to be used within SimpleClient's. This constructor is provided for API users who create their own ORB that has a reference to the Naming Service.
- Parameters:
-
| channelName | name of the channel to connect too. |
| orb_mp | ORB that has a valid reference to the Naming Service. |
nc::Consumer::Consumer |
( |
const char * |
channelName, |
|
|
int |
argc, |
|
|
char * |
argv[] | |
|
) |
| | |
Optional constructor - used outside of ACS. This constructor is very resource intensive (it spawns it's own ORB) and should only to be utilized when there is a reason not to use Manager to get at the Naming Service. If argc==0, default parameters (i.e., environment variables) specify how to get to the Naming Service. Otherwise, it is assumed argv has a valid corbaloc to the Naming Service.
- Parameters:
-
| channelName | name of the channel to connect to. |
| argc | Number of ORB parameters in argv or 0 |
| argv | ORB params. Typically something like:
orbArg[0] = ""
. orbArg[1] = "-ORBInitRef NameService=corbaloc::host:xxxx/NameService"
orbArg[2] = "-ORBDottedDecimalAddresses=1"
Sample Usage:
- Consumer("fridge",0,(char **)0); - Generates ORB arguments on the fly from environment variables.
- Consumer("fridge",argc,argv); - Uses passed ORB arguments.
|
virtual nc::Consumer::~Consumer |
( |
|
) |
[inline, protected, virtual] |
nc::Consumer::Consumer |
( |
const Consumer & |
|
) |
[private] |
ALMA C++ coding standards state copy constructors should be disabled.
Member Function Documentation
int nc::Consumer::addFilter |
( |
const char * |
type_name, |
|
|
const char * |
filter | |
|
) |
| | |
Filter out events meeting certain requirements. Because ALMA has chosen to define ICD events solely in terms of IDL structs, this method has little use. For interested developers with free time on their hands, please see OMG's documentation on the Extended Trader Constraint language to see what filters look like used with simple CORBA types.
- Parameters:
-
| type_name | Type of structured events to filter. |
| filter | Extended trader constraint language filter string. |
- Returns:
- ID of the filter object (used to remove the filter later).
- Exceptions:
-
| ACSErrTypeCommon::CORBAProblemEx |
|
template<class T >
void nc::Consumer::addSubscription |
( |
|
) |
[inline] |
Subscribe to more events.
The template parameter T is the ALMA event type to subscribe to.
- Returns:
- void
- Exceptions:
-
| ACSErrTypeCommon::CORBAProblemEx |
|
void nc::Consumer::addSubscription |
( |
const char * |
type_name |
) |
[private] |
Subscribe to more events. In all likelehood this method will become private very soon.
- Parameters:
-
| type_name | Type of structured events to subscribe to. |
- Returns:
- void
- Exceptions:
-
| ACSErrTypeCommon::CORBAProblemEx |
|
void nc::Consumer::consumerReady |
( |
|
) |
|
After this method is invoked, the developer has little control over when events are received (i.e., push_structured_event() is invoked).
- Exceptions:
-
| ACSErrTypeCommon::CORBAProblemEx | |
- Returns:
- void
void nc::Consumer::createConsumer |
( |
|
) |
[protected] |
Utility method. Creates a proxy supplier and consumer admin. Next connect this consumer to the proxy supplier.
- Returns:
- void
- Exceptions:
-
| ACSErrTypeCommon::CORBAProblemEx |
|
virtual void nc::Consumer::disconnect |
( |
|
) |
[virtual] |
Disconnect from the channel. Call this instead of deleting the object. Once disconnect has been invoked, developers should treat the object as if it has been deleted.
- Returns:
- void
virtual void nc::Consumer::disconnect_structured_push_consumer |
( |
|
) |
[virtual] |
The Supplier calls this when it disconnects from the channel. Do not call it on your own!
- Returns:
- void
virtual const char* nc::Consumer::getFilterLanguage |
( |
|
) |
[protected, virtual] |
This method returns a constant character pointer to the type of filter constraint language to be used for filtering events which is normally equivalent to acsnc::FILTER_LANGUAGE_NAME. Override to change this behavior.
- Returns:
- pointer to a constant string.
void nc::Consumer::init |
( |
CORBA::ORB_ptr |
orb |
) |
[private] |
Utility method. Initialization method where code common to all constructors is kept.
- Parameters:
-
| orb | ORB which has a reference to the Naming Service. |
- Exceptions:
-
| ACSErrTypeCommon::CORBAProblemEx |
|
void nc::Consumer::init |
( |
|
) |
[protected] |
Utility method. Initialization method where code common to all constructors is kept. It shall be called explicitly in the constructors of the derived classes, since it is actually NOT called in the constructors of this pure virtual class.
- Exceptions:
-
| ACSErrTypeCommon::CORBAProblemEx |
|
virtual void nc::Consumer::offer_change |
( |
const CosNotification::EventTypeSeq & |
added, |
|
|
const CosNotification::EventTypeSeq & |
removed | |
|
) |
| | [virtual] |
Supplier calls this when it has events to add or remove from the notification channel. Note that this method contains only a bare-bones implementation.Do not call it on your own!
- Parameters:
-
| added | Events the publisher will start publishing to the NC. |
| removed | Events the publisher will stop publishing to the NC. |
- Exceptions:
-
| CosNotifyComm::InvalidEventType | |
- Returns:
- void
void nc::Consumer::operator= |
( |
const Consumer & |
|
) |
[private] |
ALMA C++ coding standards state assignment operators should be disabled.
virtual void nc::Consumer::push_structured_event |
( |
const CosNotification::StructuredEvent & |
publishedEvent |
) |
[pure virtual] |
virtual void nc::Consumer::reconnect |
( |
::NotifyMonitoringExt::EventChannelFactory * |
ecf |
) |
[virtual] |
Override of reconnect method
- See also:
- acsnc::Helper::reconnect
Reimplemented from nc::Helper.
bool nc::Consumer::removeFilter |
( |
int |
filter_id |
) |
|
Remove a filter. See comments on the addFilter() method.
- Parameters:
-
| filter_id | ID of the filter object created by the addFilter() method. |
- Returns:
- True on success, false otherwise.
- Exceptions:
-
| ACSErrTypeCommon::CORBAProblemEx |
|
template<class T >
void nc::Consumer::removeSubscription |
( |
|
) |
[inline] |
Unsubscribe from events.
The template parameter T is the type of structured events to unsubscribe from.
- Returns:
- void
- Exceptions:
-
| ACSErrTypeCommon::CORBAProblemEx |
|
void nc::Consumer::removeSubscription |
( |
const char * |
type_name |
) |
[private] |
Unsubscribe from events.
- Parameters:
-
| type_name | Type of structured events to unsubscribe from. |
- Exceptions:
-
| ACSErrTypeCommon::CORBAProblemEx | |
- Returns:
- void
void nc::Consumer::resume |
( |
|
) |
|
A suspended (see suspend()) connection can be resumed. All events queued during suspend will be forward to the Consumer!
- Returns:
- void
- Exceptions:
-
| ACSErrTypeCommon::CORBAProblemEx |
|
void nc::Consumer::setAntennaName |
( |
std::string |
antennaName |
) |
|
void nc::Consumer::suspend |
( |
|
) |
|
After this method is invoked, the connection is suspended. All events published on this channel will not be processed by this Consumer instance, but they will be queued by the Supplier. After resuming the connection all queued events will be forwarded to the Consumer!
- Returns:
- void
Member Data Documentation
The consumer admin object used by consumers to get a reference to the structured supplier proxy.
Default maximum amount of time an event handler is given to process event before an exception is logged. this is used when an enduser does *not* define the appropriate XML elements within the ACS CDB. see the inline doc on EventChannel.xsd for more info. Also, this value is in floating point seconds.
Maps events to the total amount of time they have to be processed.
The number of events received so far. It is up do the developer to update this variable.
ORB used by this consumer.
Used to profile handler times.
The proxy supplier that we are connected to. This invokes methods defined in IDL stub class such as push_structured_event().
Handle destruction using an _var reference to the underlying CORBA object.
The documentation for this class was generated from the following file: