FACT++  1.0
dimcpp.cxx
Go to the documentation of this file.
1 #include <assert.h>
2 #include <signal.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5 #ifdef __VMS
6 #include <starlet.h>
7 #endif
8 
9 #define DIMLIB
10 #include <dim_core.hxx>
11 #include <dim.hxx>
12 
13 int DimCore::inCallback = 0;
15 char *DimUtil::itsBuffer = (char *)0;
16 
17 extern "C" {
18 static void timer_user_routine(void *tp)
19 {
20  DimTimer *t = (DimTimer *)tp;
22  t->firedFlag = 1;
23  t->runningFlag = 0;
24  t->timerHandler();
26 }
27 }
28 
30 {
31  if(runningFlag)
32  return 0;
33  runningFlag = 1;
34  firedFlag = 0;
36  return 1;
37 }
38 
40 {
41  firedFlag = 0;
42  runningFlag = 0;
43  return dtq_stop_timer(this);
44 }
45 
47 {
48  firedFlag = 0;
49  runningFlag = 0;
50 }
51 
53 {
54  firedFlag = 0;
55  runningFlag = 0;
56  start(time);
57 }
58 
60 {
61  if(runningFlag)
62  stop();
63 }
64 
65 // Threads
66 
67 extern "C" {
68 static void thread_user_routine(void *tp)
69 {
70  DimThread *t = (DimThread *)tp;
71 // DimCore::inCallback = 1;
72 // t->firedFlag = 1;
73 // t->runningFlag = 0;
74  t->threadHandler();
75  t->itsId = 0;
76 // DimCore::inCallback = 0;
77 }
78 }
79 
81 {
82 // start();
83  itsId = 0;
84 }
85 
87 {
88 // if(itsId)
89 // stop();
90 }
91 
93 {
94  if(!itsId)
95  {
96  itsId = (long)dim_start_thread(thread_user_routine, this);
97  return 1;
98  }
99  return 0;
100 }
101 /*
102 int DimThread::stop()
103 {
104  int ret = dim_stop_thread(itsId);
105  itsId = 0;
106  return ret;
107 }
108 */
109 
111 {
112 }
113 
115 {
116 }
117 
118 char *DimUtil::getEnvVar(char *name)
119 {
120  int size;
121 
122  size = dim_get_env_var(name, 0, 0);
123  if(!size)
124  return (char *)0;
125  if((itsBufferSize < size ) && (itsBufferSize != 0))
126  {
127  delete[] itsBuffer;
128  itsBufferSize = 0;
129  }
130  if(!itsBufferSize)
131  {
132  itsBuffer = new char[size];
133  itsBufferSize = size;
134  }
135  dim_get_env_var(name, itsBuffer, itsBufferSize);
136  return itsBuffer;
137 }
int start(int time)
Definition: dimcpp.cxx:29
~DimUtil()
Definition: dimcpp.cxx:114
int runningFlag
Definition: dim.hxx:24
dim_get_env_var("EXTRA_DNS_NODE", extra_dns, sizeof(extra_dns))
virtual void timerHandler()
Definition: dim.hxx:32
static int itsBufferSize
Definition: dim.hxx:57
static char * getEnvVar(char *varName)
Definition: dimcpp.cxx:118
dim_long dim_start_thread(void *(*thread_ast)(void *), dim_long tag)
Definition: dim_thr.c:231
static void timer_user_routine(void *tp)
Definition: dimcpp.cxx:18
static char * itsBuffer
Definition: dim.hxx:56
long itsId
Definition: dim.hxx:38
int start()
Definition: dimcpp.cxx:92
static int inCallback
Definition: dim.hxx:11
void dtq_start_timer(int time, void(*user_routine)(), dim_long tag)
Definition: dtq.c:790
DimThread()
Definition: dimcpp.cxx:80
int dtq_stop_timer(dim_long tag)
Definition: dtq.c:806
int stop()
Definition: dimcpp.cxx:39
int firedFlag
Definition: dim.hxx:23
virtual ~DimTimer()
Definition: dimcpp.cxx:59
Warning because the service this data corrsponds to might have been last updated longer ago than Local time
Definition: smartfact.txt:92
int size
Definition: db_dim_server.c:17
virtual ~DimThread()
Definition: dimcpp.cxx:86
DimTimer()
Definition: dimcpp.cxx:46
TT t
Definition: test_client.c:26
DimUtil()
Definition: dimcpp.cxx:110
static void thread_user_routine(void *tp)
Definition: dimcpp.cxx:68
virtual void threadHandler()
Definition: dim.hxx:47
Definition: dim.hxx:20