summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Notify/AdminProperties.cpp
blob: 0320fccfb3016b4c44f7fb26cbab216c38436619 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// $Id$

#include "AdminProperties.h"

#if ! defined (__ACE_INLINE__)
#include "AdminProperties.inl"
#endif /* __ACE_INLINE__ */

ACE_RCSID(Notify, TAO_NS_AdminProperties, "$id$")

#include "orbsvcs/CosNotificationC.h"

TAO_NS_AdminProperties::TAO_NS_AdminProperties (void)
  : max_queue_length_ (CosNotification::MaxQueueLength, 0),
    max_consumers_ (CosNotification::MaxSuppliers, 0),
    max_suppliers_ (CosNotification::MaxConsumers, 0),
    reject_new_events_ (CosNotification::RejectNewEvents, 0)
{
}

TAO_NS_AdminProperties::~TAO_NS_AdminProperties ()
{
}

int
TAO_NS_AdminProperties::init (const CosNotification::PropertySeq& prop_seq)
{
  if (TAO_NS_PropertySeq::init (prop_seq) != 0)
    return -1;

  this->max_queue_length_.set (*this);
  this->max_consumers_.set (*this);
  this->max_suppliers_.set (*this);
  this->reject_new_events_.set (*this);

  //@@ check if unsupported property was set.
  // This will happen when number of successfull inits != numbers of items bound in map_.

  return 0;
}

CORBA::Boolean
TAO_NS_AdminProperties::queue_full (void)
{
  if (this->max_queue_length () == 0)
    return 0;
  else
    if (this->queue_length ().value () > this->max_queue_length ().value ())
      return 1;

  return 0;
}

#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)

template class ACE_Atomic_Op<TAO_SYNCH_MUTEX,int>;
template class ACE_Atomic_Op_Ex<TAO_SYNCH_MUTEX,int>;
template class TAO_Notify_Signal_Property<TAO_SYNCH_MUTEX,int>;

#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)

#pragma instantiate ACE_Atomic_Op<TAO_SYNCH_MUTEX,int>
#pragma instantiate ACE_Atomic_Op_Ex<TAO_SYNCH_MUTEX,int>
#pragma instantiate TAO_Notify_Signal_Property<TAO_SYNCH_MUTEX,int>

#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */