NetDest.hh (7039:bc0b6ea676b5) NetDest.hh (7055:4e24742201d7)
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 20 unchanged lines hidden (view full) ---

29// NetDest specifies the network destination of a NetworkMessage
30// This is backward compatible with the Set class that was previously
31// used to specify network destinations.
32// NetDest supports both node networks and component networks
33
34#ifndef __MEM_RUBY_COMMON_NETDEST_HH__
35#define __MEM_RUBY_COMMON_NETDEST_HH__
36
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 20 unchanged lines hidden (view full) ---

29// NetDest specifies the network destination of a NetworkMessage
30// This is backward compatible with the Set class that was previously
31// used to specify network destinations.
32// NetDest supports both node networks and component networks
33
34#ifndef __MEM_RUBY_COMMON_NETDEST_HH__
35#define __MEM_RUBY_COMMON_NETDEST_HH__
36
37#include "mem/ruby/common/Global.hh"
37#include <iostream>
38
38#include "mem/gems_common/Vector.hh"
39#include "mem/gems_common/Vector.hh"
39#include "mem/ruby/system/NodeID.hh"
40#include "mem/ruby/system/MachineID.hh"
41#include "mem/ruby/common/Set.hh"
42#include "mem/protocol/MachineType.hh"
40#include "mem/protocol/MachineType.hh"
41#include "mem/ruby/common/Global.hh"
42#include "mem/ruby/common/Set.hh"
43#include "mem/ruby/system/MachineID.hh"
44#include "mem/ruby/system/NodeID.hh"
43
44class NetDest
45{
46 public:
47 // Constructors
48 // creates and empty set
49 NetDest();
50 explicit NetDest(int bit_size);

--- 42 unchanged lines hidden (view full) ---

93 MachineID smallestElement(MachineType machine) const;
94
95 void setSize();
96 int getSize() const { return m_bits.size(); }
97
98 // get element for a index
99 NodeID elementAt(MachineID index);
100
45
46class NetDest
47{
48 public:
49 // Constructors
50 // creates and empty set
51 NetDest();
52 explicit NetDest(int bit_size);

--- 42 unchanged lines hidden (view full) ---

95 MachineID smallestElement(MachineType machine) const;
96
97 void setSize();
98 int getSize() const { return m_bits.size(); }
99
100 // get element for a index
101 NodeID elementAt(MachineID index);
102
101 void print(ostream& out) const;
103 void print(std::ostream& out) const;
102
103 private:
104 // returns a value >= MachineType_base_level("this machine")
105 // and < MachineType_base_level("next highest machine")
106 int
107 vecIndex(MachineID m) const
108 {
109 int vec_index = MachineType_base_level(m.type);

--- 5 unchanged lines hidden (view full) ---

115 bitIndex(NodeID index) const
116 {
117 return index;
118 }
119
120 Vector <Set> m_bits; // a Vector of bit vectors - i.e. Sets
121};
122
104
105 private:
106 // returns a value >= MachineType_base_level("this machine")
107 // and < MachineType_base_level("next highest machine")
108 int
109 vecIndex(MachineID m) const
110 {
111 int vec_index = MachineType_base_level(m.type);

--- 5 unchanged lines hidden (view full) ---

117 bitIndex(NodeID index) const
118 {
119 return index;
120 }
121
122 Vector <Set> m_bits; // a Vector of bit vectors - i.e. Sets
123};
124
123inline ostream&
124operator<<(ostream& out, const NetDest& obj)
125inline std::ostream&
126operator<<(std::ostream& out, const NetDest& obj)
125{
126 obj.print(out);
127{
128 obj.print(out);
127 out << flush;
129 out << std::flush;
128 return out;
129}
130
131#endif // __MEM_RUBY_COMMON_NETDEST_HH__
132
130 return out;
131}
132
133#endif // __MEM_RUBY_COMMON_NETDEST_HH__
134