summaryrefslogtreecommitdiff
path: root/modules/CIAO/examples/DevGuideExamples/Messenger/Publication_exec_i.cpp
blob: 4deab544b8bf8c05bc76b97805ab6f9b8429f3c3 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// $Id$
//
// ****              Code generated by the                 ****
// ****  Component Integrated ACE ORB (CIAO) CIDL Compiler ****
// CIAO has been developed by:
//       Center for Distributed Object Computing
//       Washington University
//       St. Louis, MO
//       USA
//       http://www.cs.wustl.edu/~schmidt/doc-center.html
// CIDL Compiler has been developed by:
//       Institute for Software Integrated Systems
//       Vanderbilt University
//       Nashville, TN
//       USA
//       http://www.isis.vanderbilt.edu/
//
// Information about CIAO is available at:
//    http://www.dre.vanderbilt.edu/CIAO

#include "Publication_exec_i.h"
#include "ciao/CIAO_common.h"

namespace CIAO_Messenger_Impl
{
  //==================================================================
  // Facet Executor Implementation Class:   Publication_exec_i
  //==================================================================

  Publication_exec_i::Publication_exec_i (
    const char* text, CORBA::UShort period)
    : text_( text ),
      period_( period)
  {
  }

  Publication_exec_i::~Publication_exec_i (void)
  {
  }

  // Operations from ::Publication

  char*
  Publication_exec_i::text ()
  {
    ACE_Guard<TAO_SYNCH_MUTEX> guard(this->lock_);

    return CORBA::string_dup( this->text_.c_str() );
  }

  void
  Publication_exec_i::text (
  const char* text)
  {
    ACE_Guard<TAO_SYNCH_MUTEX> guard(this->lock_);

    this->text_ = text;
    ACE_DEBUG((LM_INFO, ACE_TEXT("publication text changed to %C\n"), text ));
  }

  CORBA::UShort
  Publication_exec_i::period ()
  {
    ACE_Guard<TAO_SYNCH_MUTEX> guard(this->lock_);

    return this->period_;
  }

  void
  Publication_exec_i::period (CORBA::UShort period)
  {
    ACE_Guard<TAO_SYNCH_MUTEX> guard( this->lock_ );

    if ( period > 0 ) {
      this->period_ = period;
      ACE_DEBUG((LM_INFO, ACE_TEXT("publication period changed to %d seconds\n"), period ));
    } else {
      ACE_DEBUG((LM_INFO, ACE_TEXT("ignoring a negative period of %d\n"), period ));
    }
  }
}