00001
00002 #ifndef LESTER_COUNTEDEXAMPLE_H
00003 #define LESTER_COUNTEDEXAMPLE_H
00004
00005 #include "Rabbit.hh"
00006
00007 #include <ipc/object.h>
00008 #include <iostream>
00009 #include "Sct/RefCountServantBase.h"
00010
00011 class CountedExample :
00012 public IPCObject<POA_Stew::CountedExample,
00013 ipc::single_thread>,
00014 private Sct::RefCountServantBase
00015 {
00016
00017 public:
00018 CountedExample() {
00019 std::cout << "Constructing a CountedExample ... " << std::endl;
00020
00021 };
00022
00023 public:
00024 virtual ~CountedExample() {
00025 std::cout << "~CountedExample()" << std::endl;
00026 };
00027
00028 void addRef() {
00029 std::cout << "CountedExample::addCount" << std::endl;
00030 this->_sct_add_ref();
00031 };
00032
00033 void removeRef() {
00034 std::cout << "CountedExample::removeCount" << std::endl;
00035 this->_sct_remove_ref();
00036
00037
00038
00039 };
00040
00041 void performCountEqualsZeroAction() {
00042 std::cout << "Moo .. count has reached zero! I think I will commit suicide!" << std::endl;
00043 this->_destroy();
00044 };
00045
00046 };
00047
00048 #endif