nc::Consumer

NAME
SYNOPSIS
Detailed Description
Constructor & Destructor Documentation
Member Function Documentation
Member Data Documentation
Author

NAME

nc::Consumer −

SYNOPSIS

#include <acsncConsumer.h>

Inherits nc::Helper.

Inherited by nc::ArchiveConsumer, nc::SimpleConsumer< T >, nc::SimpleConsumer< ACSCOURSE_MOUNT::MountEventData >, nc::SimpleConsumer< acsnc::EventDescription >, and nc::SimpleConsumer< COUNTER::statusBlockEvent >.

Public Member Functions

Consumer (const char *channelName, const char *acsNCDomainName=0)

Consumer (const char *channelName, CORBA::ORB_ptr orb_mp, const char *acsNCDomainName=0)

Consumer (const char *channelName, int argc, char *argv[], const char *acsNCDomainName=0)

virtual void disconnect ()

virtual void push_structured_event (const CosNotification::StructuredEvent &publishedEvent)=0

virtual void offer_change (const CosNotification::EventTypeSeq &added, const CosNotification::EventTypeSeq &removed)

virtual void disconnect_structured_push_consumer ()

void consumerReady ()

void resume ()

void suspend ()

template<class T > void addSubscription ()

template<class T > void removeSubscription ()

int addFilter (const char *type_name, const char *filter)

bool removeFilter (int filter_id)

virtual void reconnect (::NotifyMonitoringExt::EventChannelFactory *ecf)

void setAntennaName (std::string antennaName)

Protected Member Functions

void init ()

virtual ~Consumer ()

void createConsumer ()

virtual const char * getFilterLanguage ()

Protected Attributes

CosNotifyChannelAdmin::ConsumerAdmin_var consumerAdmin_m

CosNotifyChannelAdmin::StructuredProxyPushSupplier_var proxySupplier_m

unsigned long long numEvents_m

CosNotifyComm::StructuredPushConsumer_var reference_m

CDBProperties::EventHandlerTimeoutMap handlerTimeoutMap_m

Profiler * profiler_mp

std::string antennaName

Static Protected Attributes

static double DEFAULT_MAX_PROCESS_TIME

Private Member Functions

void init (CORBA::ORB_ptr orb)

void operator= (const Consumer &)

Consumer (const Consumer &)

void addSubscription (const char *type_name)

void removeSubscription (const char *type_name)

Private Attributes

CORBA::ORB_ptr orb_mp

CosNotifyChannelAdmin::AdminID adminid

CosNotifyChannelAdmin::ProxyID proxySupplierID

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 constructor 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, const char * acsNCDomainName = 0) 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.
acsNCDomain
name of the ACS NC domain name. This is an optional parameter. It will default to acscommon::NAMESERVICE_BINDING_NC_DOMAIN_DEFAULT if it is not specified.

nc::Consumer::Consumer (const char * channelName, CORBA::ORB_ptr orb_mp, const char * acsNCDomainName = 0) 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.
acsNCDomain
name of the ACS NC domain name. This is an optional parameter. It will default to acscommon::NAMESERVICE_BINDING_NC_DOMAIN_DEFAULT if it is not specified.

nc::Consumer::Consumer (const char * channelName, int argc, char * argv[], const char * acsNCDomainName = 0) 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[2] = ’-ORBDottedDecimalAddresses=1’

acsNCDomain name of the ACS NC domain name. This is an optional parameter. It will default to acscommon::NAMESERVICE_BINDING_NC_DOMAIN_DEFAULT if it is not specified.

virtual nc::Consumer::~Consumer () [inline, protected, virtual] Destructor is protected.

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

Reimplemented in nc::SimpleConsumer< T >, nc::SimpleConsumer< acsnc::EventDescription >, nc::SimpleConsumer< ACSCOURSE_MOUNT::MountEventData >, and nc::SimpleConsumer< COUNTER::statusBlockEvent >.

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] This pure virtual function must be overridden by the child class to receive data from the channel. Do not call it on your own!

Parameters:

publishedEvent The real CORBA event (defined via an IDL definition). This structure has little to do with so-called ICD events.

Exceptions:

CosEventComm::Disconnected

Returns:

void

Implemented in nc::ArchiveConsumer, nc::SimpleConsumer< T >, nc::SimpleConsumer< acsnc::EventDescription >, nc::SimpleConsumer< ACSCOURSE_MOUNT::MountEventData >, and nc::SimpleConsumer< COUNTER::statusBlockEvent >.

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

CosNotifyChannelAdmin::AdminID nc::Consumer::adminid [private]

std::string nc::Consumer::antennaName [protected]

CosNotifyChannelAdmin::ConsumerAdmin_var nc::Consumer::consumerAdmin_m [protected] The consumer admin object used by consumers to get a reference to the structured supplier proxy.

double nc::Consumer::DEFAULT_MAX_PROCESS_TIME [static, protected] 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.

CDBProperties::EventHandlerTimeoutMap nc::Consumer::handlerTimeoutMap_m [protected] Maps events to the total amount of time they have to be processed.

unsigned long long nc::Consumer::numEvents_m [protected] The number of events received so far. It is up do the developer to update this variable.

CORBA::ORB_ptr nc::Consumer::orb_mp [private] ORB used by this consumer.

Profiler* nc::Consumer::profiler_mp [protected] Used to profile handler times.

CosNotifyChannelAdmin::StructuredProxyPushSupplier_var nc::Consumer::proxySupplier_m [protected] The proxy supplier that we are connected to. This invokes methods defined in IDL stub class such as push_structured_event().

CosNotifyChannelAdmin::ProxyID nc::Consumer::proxySupplierID [private]

CosNotifyComm::StructuredPushConsumer_var nc::Consumer::reference_m [protected] Handle destruction using an _var reference to the underlying CORBA object.

Author

Generated automatically by Doxygen for ACS-2015.2 C++ API from the source code.