SST/macro
software_id.h
Go to the documentation of this file.
1 /*
2  * This file is part of SST/macroscale:
3  * The macroscale architecture simulator from the SST suite.
4  * Copyright (c) 2009 Sandia Corporation.
5  * This software is distributed under the BSD License.
6  * Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
7  * the U.S. Government retains certain rights in this software.
8  * For more information, see the LICENSE file in the top
9  * SST/macroscale directory.
10  */
11 
12 #ifndef SSTMAC_SOFTWARE_PROCESS_software_id_H_INCLUDED
13 #define SSTMAC_SOFTWARE_PROCESS_software_id_H_INCLUDED
14 
15 #include <iostream>
16 #include <sstream>
20 
21 namespace sstmac {
22 namespace sw {
23 
24 /**
25  * A wrapper for an appid, taskid pair
26  *
27  */
28 struct software_id {
32 
33  explicit software_id(app_id a, task_id t, thread_id th = thread_id(0))
34  : app_(a), task_(t), thread_(th) {}
35 
36  software_id() : app_(-1), task_(-1) { }
37 
38  std::string to_string() const {
39  std::stringstream ss(std::stringstream::in | std::stringstream::out);
40  ss << "software_id(" << app_ << ", " << task_ << "," << thread_ << ")";
41  return ss.str();
42  }
43 };
44 
45 inline bool operator==(const software_id &a, const software_id &b)
46 {
47  return (a.app_ == b.app_ && a.task_ == b.task_ && a.thread_ == b.thread_);
48 }
49 inline bool operator!=(const software_id &a, const software_id &b)
50 {
51  return (a.app_ != b.app_ || a.task_ != b.task_ || a.thread_ != b.thread_);
52 }
53 inline bool operator<(const software_id &a, const software_id &b)
54 {
55  return (a.task_ < b.task_);
56 }
57 inline bool operator>(const software_id &a, const software_id &b)
58 {
59  return (a.task_ > b.task_);
60 }
61 
62 
63 inline std::ostream& operator<<(std::ostream &os, const software_id &n)
64 {
65  return (os << n.to_string());
66 }
67 
68 }
69 } // end of namespace sstmac
70 
71 #endif
72 
std::ostream & operator<<(std::ostream &os, const dumpi_status &status)
Print status info.
Definition: dumpi_type_io.h:33
int thread_id
Definition: thread_id.h:21
software_id(app_id a, task_id t, thread_id th=thread_id(0))
Definition: software_id.h:33
std::string to_string() const
Definition: software_id.h:38
int task_id
Definition: task_id.h:20
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
bool operator<(const U &b, const sstmac_global_builtin< T > &t)
bool operator>(const U &b, const sstmac_global_builtin< T > &t)
bool operator==(const software_id &a, const software_id &b)
Definition: software_id.h:45
bool operator!=(const software_id &a, const software_id &b)
Definition: software_id.h:49
A wrapper for an appid, taskid pair.
Definition: software_id.h:28
int app_id
Definition: app_id.h:20