OpenASIP 2.2
Loading...
Searching...
No Matches
SocketEncoding.hh
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2009 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file SocketEncoding.hh
26 *
27 * Declaration of SocketEncoding class.
28 *
29 * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#ifndef TTA_SOCKET_ENCODING_HH
34#define TTA_SOCKET_ENCODING_HH
35
36#include "Encoding.hh"
37
38class SocketCodeTable;
39class SlotField;
40
41/**
42 * The SocketEncoding class models how socket sources or destinations are
43 * mapped to control codes.
44 *
45 * Sockets have an independent encoding in each source or destination
46 * field they appear in. A socket encoding can be more complex than a
47 * fixed control code and encode many destinations or sources all
48 * reached from the same socket. In this case, the socket encoding
49 * contains SocketCodeTable instance.
50 */
51class SocketEncoding : public Encoding {
52public:
54 const std::string& name, unsigned int encoding, unsigned int extraBits,
57 virtual ~SocketEncoding();
58
59 SlotField* parent() const;
60
61 std::string socketName() const;
62
63 void setSocketCodes(SocketCodeTable& codeTable);
64 void unsetSocketCodes();
65 bool hasSocketCodes() const;
67 int socketCodePosition() const;
68
69 void setEncoding(unsigned int encoding, unsigned int extraBits);
70
71 int socketIDPosition() const;
72 int socketIDWidth() const;
73 virtual int width() const;
74 virtual int bitPosition() const;
75
76 virtual ObjectState* saveState() const;
77
78 /// ObjectState name for socket encoding.
79 static const std::string OSNAME_SOCKET_ENCODING;
80 /// ObjectState attribute key for the name of the socket.
81 static const std::string OSKEY_SOCKET_NAME;
82 /// ObjectState attribute key for the name of the socket code table.
83 static const std::string OSKEY_SC_TABLE;
84
85private:
86
87 void detachFromParent();
88
89 /// Name of the socket.
90 std::string name_;
91 /// Socket code table.
93};
94
95#endif
unsigned int extraBits() const
Definition Encoding.cc:119
unsigned int encoding() const
Definition Encoding.cc:108
virtual ObjectState * saveState() const
virtual int width() const
SocketCodeTable & socketCodes() const
virtual int bitPosition() const
bool hasSocketCodes() const
static const std::string OSNAME_SOCKET_ENCODING
ObjectState name for socket encoding.
void setEncoding(unsigned int encoding, unsigned int extraBits)
virtual ~SocketEncoding()
std::string socketName() const
void setSocketCodes(SocketCodeTable &codeTable)
int socketIDWidth() const
static const std::string OSKEY_SOCKET_NAME
ObjectState attribute key for the name of the socket.
SlotField * parent() const
SocketCodeTable * socketCodes_
Socket code table.
static const std::string OSKEY_SC_TABLE
ObjectState attribute key for the name of the socket code table.
std::string name_
Name of the socket.
int socketIDPosition() const
int socketCodePosition() const