summaryrefslogtreecommitdiff
path: root/TAO/examples/RTCORBA/Activity/Activity.h
diff options
context:
space:
mode:
authorpradeep <pradeep@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-12-20 00:03:34 +0000
committerpradeep <pradeep@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-12-20 00:03:34 +0000
commit0c306062d50b93cd98f6e0bcd1459536cff549f6 (patch)
treea44df38a5fceb93e101801c1121b46fe0bb0980b /TAO/examples/RTCORBA/Activity/Activity.h
parent7717693ebe7fa9a0f303c06b9928b1d12324d368 (diff)
downloadATCD-0c306062d50b93cd98f6e0bcd1459536cff549f6.tar.gz
ChangeLogTag: Wed Dec 19 15:36:14 2001 Pradeep Gore <pradeep@cs.wustl.edu>
Diffstat (limited to 'TAO/examples/RTCORBA/Activity/Activity.h')
-rw-r--r--TAO/examples/RTCORBA/Activity/Activity.h129
1 files changed, 129 insertions, 0 deletions
diff --git a/TAO/examples/RTCORBA/Activity/Activity.h b/TAO/examples/RTCORBA/Activity/Activity.h
new file mode 100644
index 00000000000..04e8827f948
--- /dev/null
+++ b/TAO/examples/RTCORBA/Activity/Activity.h
@@ -0,0 +1,129 @@
+/* -*- C++ -*- */
+//=============================================================================
+/**
+ * @file Activity.h
+ *
+ * $Id$
+ *
+ * An activity is a process that contains Tasks.
+ * Each Task is composed of certain units of Jobs.
+ * A Job can perform work that is local/remote.
+ * Each Job is identified with a name.
+ *
+ * @author Pradeep Gore <pradeep@cs.wustl.edu>
+ */
+//=============================================================================
+#ifndef ACTIVITY_H
+#define ACTIVITY_H
+
+#include "ace/Singleton.h"
+#include "ace/Sched_Params.h"
+#include "orbsvcs/CosNamingC.h"
+#include "tao/RTPortableServer/RTPortableServer.h"
+
+class ACE_Barrier;
+class Job_i;
+class Periodic_Task;
+class Builder;
+
+/**
+ * @class Activity
+ *
+ * @brief Driver class that maintains the orb and collections of objects for
+ * generating activity in this process.
+ *
+ */
+class Activity
+{
+ friend class ACE_Singleton<Activity, ACE_Null_Mutex>;
+
+private:
+ Activity ();
+ ~Activity ();
+
+public:
+ /// initialize the ORB et. al.
+ int init (int& argc, char *argv [] TAO_ENV_ARG_DECL);
+
+
+ /// Activate the tasks, jobs, poas.
+ void run (int argc, char *argv[] TAO_ENV_ARG_DECL);
+
+ /// Resolve the naming service.
+ int resolve_naming_service (TAO_ENV_SINGLE_ARG_DECL);
+
+ /// = Accessors
+ CORBA::ORB_ptr orb (void);
+ RTCORBA::Current_ptr current (void);
+ long scope_policy (void);
+ long sched_policy (void);
+ void builder (Builder* builder);
+
+ /// Returns priority if server declared model else -1
+ CORBA::Short get_server_priority (CORBA::Object_ptr server
+ TAO_ENV_ARG_DECL);
+ /// = Callbacks
+ /// Task ended notification
+ void task_ended (Periodic_Task* ended_task);
+
+ /// Job shutdown notification
+ void job_ended (Job_i* ended_job);
+
+ protected:
+ /// Init sched mode.
+ int init_sched (void);
+
+ /// = Activation methods.
+ /// Activate the POA's
+ void activate_poa_list (TAO_ENV_SINGLE_ARG_DECL);
+
+ /// Activate the task list.
+ void activate_schedule (TAO_ENV_SINGLE_ARG_DECL);
+
+ /// Activate the Job's
+ void activate_job_list (TAO_ENV_SINGLE_ARG_DECL);
+
+ /// Check if we should process exit
+ void check_ifexit (void);
+
+ /// = Data members
+
+ /// The Builder object.
+ Builder* builder_;
+
+ /// = Policies
+ long thr_sched_policy_;
+ long thr_scope_policy_;
+ ACE_Sched_Params::Policy sched_policy_;
+
+ /// ACE_Barrier to synch. tasks.
+ ACE_Barrier* barrier_;
+
+ /// Mutex to serialize access to our internal state.
+ ACE_Lock* state_lock_;
+
+ /// The ORB that we use.
+ CORBA::ORB_var orb_;
+
+ /// RT ORB
+ RTCORBA::RTORB_var rt_orb_;
+
+ /// Current
+ RTCORBA::Current_var current_;
+
+ /// Reference to the root poa.
+ PortableServer::POA_var root_poa_;
+
+ /// A naming context.
+ CosNaming::NamingContextExt_var naming_;
+
+ /// Count the number of periodic tasks active.
+ int active_task_count_;
+
+ /// Count the number of Jobs active
+ int active_job_count_;
+};
+
+typedef ACE_Singleton<Activity, ACE_Null_Mutex> ACTIVITY;
+
+#endif /* ACTIVITY_H */