SST  7.1.0
StructuralSimulationToolkit
elibase.h
1 // Copyright 2009-2017 Sandia Corporation. Under the terms
2 // of Contract DE-NA0003525 with Sandia Corporation, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2017, Sandia Corporation
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 #ifndef SST_CORE_ELIBASE_H
13 #define SST_CORE_ELIBASE_H
14 
15 #include <sst/core/sst_types.h>
16 
17 #include <string>
18 #include <vector>
19 
20 // Component Category Definitions
21 #define COMPONENT_CATEGORY_UNCATEGORIZED 0x00
22 #define COMPONENT_CATEGORY_PROCESSOR 0x01
23 #define COMPONENT_CATEGORY_MEMORY 0x02
24 #define COMPONENT_CATEGORY_NETWORK 0x04
25 #define COMPONENT_CATEGORY_SYSTEM 0x08
26 
27 namespace SST {
28 
29 /** Describes Statistics used by a Component.
30  */
32  const char* name; /*!< Name of the Statistic to be Enabled */
33  const char* description; /*!< Brief description of the Statistic */
34  const char* units; /*!< Units associated with this Statistic value */
35  const uint8_t enableLevel; /*!< Level to meet to enable statistic 0 = disabled */
36 };
37 
38 /** Describes Parameters to a Component.
39  */
41  const char *name; /*!< Name of the parameter */
42  const char *description; /*!< Brief description of the parameter (ie, what it controls) */
43  const char *defaultValue; /*!< Default value (if any) NULL == required parameter with no default, "" == optional parameter, blank default, "foo" == default value */
44 };
45 
46 /** Describes Ports that the Component can use
47  */
49  const char *name; /*!< Name of the port. Can contain %d for a dynamic port, also %(xxx)d for dynamic port with xxx being the controlling component parameter */
50  const char *description; /*!< Brief description of the port (ie, what it is used for) */
51  const char **validEvents; /*!< List of fully-qualified event types that this Port expects to send or receive */
52 };
53 
54 /** Describes Ports that the Component can use
55  */
57  const char *name; /*!< Name of the port. Can contain %d for a dynamic port, also %(xxx)d for dynamic port with xxx being the controlling component parameter */
58  const char *description; /*!< Brief description of the port (ie, what it is used for) */
59  const std::vector<std::string> validEvents; /*!< List of fully-qualified event types that this Port expects to send or receive */
60 
61  // For backwards compatibility, convert from ElementInfoPort to ElementInfoPort2
62 private:
63  std::vector<std::string> createVector(const char** events) {
64  std::vector<std::string> vec;
65  if ( events == NULL ) return vec;
66  const char** ev = events;
67  while ( NULL != *ev ) {
68  vec.push_back(*ev);
69  ev++;
70  }
71  return vec;
72  }
73 
74 public:
75 
76  ElementInfoPort2(const ElementInfoPort* port) :
77  name(port->name),
78  description(port->description),
79  validEvents(createVector(port->validEvents))
80  {}
81 
82  ElementInfoPort2(const char* name, const char* description, const std::vector<std::string> validEvents) :
83  name(name),
84  description(description),
85  validEvents(validEvents)
86  {}
87 };
88 
90  const char * name;
91  const char * description;
92  const char * superclass;
93 };
94 
96 
97 } //namespace SST
98 
99 #endif // SST_CORE_ELIBASE_H
Definition: elibase.h:89
const char * defaultValue
Definition: elibase.h:43
const char * description
Definition: elibase.h:42
const char * description
Definition: elibase.h:58
const char ** validEvents
Definition: elibase.h:51
Definition: action.cc:17
Describes Ports that the Component can use.
Definition: elibase.h:56
Describes Statistics used by a Component.
Definition: elibase.h:31
const char * description
Definition: elibase.h:50
const char * name
Definition: elibase.h:41
const char * name
Definition: elibase.h:32
Describes Parameters to a Component.
Definition: elibase.h:40
const char * description
Definition: elibase.h:33
const char * name
Definition: elibase.h:49
const uint8_t enableLevel
Definition: elibase.h:35
const char * name
Definition: elibase.h:57
Describes Ports that the Component can use.
Definition: elibase.h:48
const std::vector< std::string > validEvents
Definition: elibase.h:59
const char * units
Definition: elibase.h:34