root/saga/trunk/saga/saga/metric.hpp

Revision 3482, 5.6 kB (checked in by amerzky, 9 months ago)

scattered commits, nothing important really
A

  • Property svn:eol-style set to native
Line 
1 //  Copyright (c) 2005-2007 Andre Merzky (andre@merzky.net)
2 //  Copyright (c) 2005-2009 Hartmut Kaiser
3 //  Copyright (c) 2007 Ole Weidner (oweidner@cct.lsu.edu)
4 //
5 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
6 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7
8 #ifndef SAGA_METRIC_HPP
9 #define SAGA_METRIC_HPP
10
11 // include stl
12 #include <map>
13 #include <string>
14 #include <vector>
15
16 // include dependent spec sections
17 #include <saga/saga/util.hpp>
18 #include <saga/saga/base.hpp>
19 #include <saga/saga/monitorable.hpp>
20 #include <saga/saga/session.hpp>
21 #include <saga/saga/context.hpp>
22 #include <saga/saga/detail/attribute.hpp>
23
24 // suppress warnings about dependent classes not being exported from the dll
25 #if defined(BOOST_MSVC)
26 #pragma warning(push)
27 #pragma warning(disable: 4251 4231 4660)
28 #endif
29
30 ///////////////////////////////////////////////////////////////////////////////
31 namespace saga
32 {
33   namespace attributes
34   {
35     ///////////////////////////////////////////////////////////////////////////
36     //  attribute names for metric
37     char const* const metric_name         = "Name";
38     char const* const metric_description  = "Description";
39     char const* const metric_mode         = "Mode";
40     char const* const metric_unit         = "Unit";
41     char const* const metric_type         = "Type";
42     char const* const metric_value        = "Value";
43
44     ///////////////////////////////////////////////////////////////////////////
45     //  attribute values for metric's type attribute
46     char const* const metric_type_string  = "String";
47     char const* const metric_type_int     = "Int";
48     char const* const metric_type_enum    = "Enum";
49     char const* const metric_type_float   = "Float";
50     char const* const metric_type_bool    = "Bool";
51     char const* const metric_type_time    = "Time";
52     char const* const metric_type_trigger = "Trigger";
53
54     ///////////////////////////////////////////////////////////////////////////
55     //  attribute values for metric's mode attribute
56     char const* const metric_mode_readonly   = "ReadOnly";
57     char const* const metric_mode_readwrite  = "ReadWrite";
58     char const* const metric_mode_final      = "Final";
59
60   }
61
62   ///@cond
63   /////////////////////////////////////////////////////////////////////////////
64   namespace metrics
65   {
66       /////////////////////////////////////////////////////////////////////////
67       //  initialization data for list of metrics
68       struct init_data
69       {
70           char const* const name;
71           char const* const description;
72           char const* const mode;
73           char const* const unit;
74           char const* const type;
75           char const* const value;
76       };
77   }     
78   ///@endcond
79    
80   /*! \brief Brief %description starts here     
81    *
82    *
83    */
84   class SAGA_EXPORT metric
85     : public saga::object,
86       public saga::detail::attribute<metric>
87   {
88    protected:
89      /// @cond
90      TR1::shared_ptr <saga::impl::metric> get_impl (void) const;
91      
92      friend struct saga::detail::attribute<metric>;  // needs to access get_impl()
93      friend class saga::impl::metric;
94      
95      explicit metric(saga::impl::metric *impl);
96      /// @endcond
97
98    public:
99      /*! \brief Brief %description starts here     
100       *
101       *
102       */
103      enum frequency
104      {
105        Unknown  = -1,
106        Cont     =  0,  // always available
107        Descreet =  1,  // available at specific intervals
108        Pull     =  2,  // available when asked for
109        Push     =  3,  // available when set
110        Event    =  4   // available when a specific event occurs
111      };
112
113      /*! \brief Brief %description starts here     
114       *
115       *
116       */
117      typedef saga::monitorable::cookie_handle metric_cookie;
118
119      /*! \brief Brief %description starts here     
120       *
121       *
122       */
123      metric (void);
124      
125      /*! \brief Brief %description starts here     
126       *
127       *
128       */
129      explicit metric (saga::object const& o);
130
131      /*! \brief Brief %description starts here     
132       *
133       *
134       */
135      // FIXME: the spec does not say anything about a target object parameter.
136      // In fact, a metric should be usable on multiple objects.  For example, an
137      // application may want to add the same metrics to several steerable
138      // job instances.
139      metric (saga::object target,
140              std::string name, std::string desc, std::string mode,
141              std::string unit, std::string type, std::string val);
142              
143      /*! \brief Brief %description starts here     
144       *
145       *
146       */
147     ~metric (void);
148
149      /*! \brief Brief %description starts here     
150       *
151       *
152       */
153      metric &operator= (saga::object const& o);
154
155      /*! \brief Brief %description starts here     
156       *
157       *
158       */
159      void fire (saga::context ctx = saga::context());
160
161      /*! \brief Brief %description starts here     
162       *
163       *
164       */
165      metric_cookie add_callback (saga::callback f);
166      
167      /*! \brief Brief %description starts here     
168       *
169       *
170       */
171      void remove_callback (metric_cookie cookie);
172      
173      /*! \brief Brief %description starts here     
174       *
175       *
176       */
177      friend SAGA_EXPORT
178      bool operator== (metric const & lhs, metric const & rhs);
179
180   };
181    /// @cond
182    /** These methods are not within API scope */
183   typedef std::vector <saga::metric> metric_list_type;
184   /// @endcond
185
186 } // namespace saga
187 ///////////////////////////////////////////////////////////////////////////////
188
189 // re-enable warnings about dependent classes not being exported from the dll
190 #if defined(BOOST_MSVC)
191 #pragma warning(pop)
192 #endif
193
194 #endif // SAGA_METRIC_HPP
195
196
Note: See TracBrowser for help on using the browser.