Manage an SNMP table. More...
#include <Table.hpp>
Public Member Functions | |
Table (Oid oid=Oid(), MasterProxy *master=0) | |
Constructor. More... | |
void | setOid (Oid oid) |
Set the OID of the table. More... | |
Oid | oid () |
Get the table's OID. More... | |
void | setMasterProxy (MasterProxy *master) |
Set the MasterProxy object used by this table. More... | |
MasterProxy * | masterProxy () |
Get the MasterProxy object associated with this table. More... | |
bool | addEntry (QSharedPointer< TableEntry > entry) |
Add an entry to the table. More... | |
bool | contains (QSharedPointer< TableEntry > entry) const |
Check whether the table contains a given entry. More... | |
bool | removeEntry (QSharedPointer< TableEntry > entry) |
Remove an entry from the table. More... | |
Private Attributes | |
QMap< QSharedPointer < TableEntry >, Oid > | entries |
The managed TableEntry objects. More... | |
MasterProxy * | myMasterProxy |
The used MasterProxy object. More... | |
Oid | myOid |
The tables OID. More... | |
Manage an SNMP table.
This class manages a sequence of TableEntry objects. Unlike normal variables (which inherit from AbstractVariable), the table cannot be registered with a MasterProxy object. Instead, the table itself holds a pointer to a MasterProxy object and adds and removes its variables dynamically.
To implement an SNMP table, a Table object is created and provided with
Each TableEntry object has an index, which must be unique within a table. The Table class ensures this when adding a TableEntry.
The OID's of the variables within a table are derived from the index of their TableEntry, which in turn is derived from the contents of the index variables of that very entry. The index variables are normal SNMP variables which can be changed (either programatically or by an SNMP set operation). In such a case, the TableEntry's index would change. However, the Table object is currently not able to detect such a change, i.e. variables will keep their OID instead of changing it according to the new index.
|
inline |
Constructor.
Create a Table object, assign it an OID and associate it with a MasterProxy object. If master is 0, no TableEntry's may be added.
oid | The tables OID. |
master | The MasterProxy which is used by the table to add variables. |
None. |
bool Table::addEntry | ( | QSharedPointer< TableEntry > | entry | ) |
Add an entry to the table.
This method adds all variables of the entry to the MasterProxy.
This function fails in the following cases:
entry | The TableEntry object to add. |
None. |
Definition at line 29 of file Table.cpp.
References agentxcpp::MasterProxy::addVariables(), entries, agentxcpp::Oid::is_null(), myMasterProxy, and myOid.
bool Table::contains | ( | QSharedPointer< TableEntry > | entry | ) | const |
|
inline |
Get the MasterProxy object associated with this table.
None. |
Definition at line 156 of file Table.hpp.
References myMasterProxy.
|
inline |
bool Table::removeEntry | ( | QSharedPointer< TableEntry > | entry | ) |
Remove an entry from the table.
This method removes all variables of the entry from the MasterProxy.
This function fails in the following cases:
entry | The TableEntry object to remove. |
None. |
Definition at line 96 of file Table.cpp.
References entries, myMasterProxy, myOid, and agentxcpp::MasterProxy::removeVariables().
|
inline |
Set the MasterProxy object used by this table.
master | The new MasterProxy object. |
None. |
Definition at line 144 of file Table.hpp.
References myMasterProxy.
|
inline |
Set the OID of the table.
This OID is used to build up the full OID of the variables contained in the table.
oid | The new table OID. |
None. |
|
private |
The managed TableEntry objects.
For each entry the following data is stored:
Definition at line 216 of file Table.hpp.
Referenced by addEntry(), contains(), and removeEntry().
|
private |
The used MasterProxy object.
May be NULL.
Definition at line 223 of file Table.hpp.
Referenced by addEntry(), masterProxy(), removeEntry(), and setMasterProxy().
|
private |
The tables OID.
Definition at line 228 of file Table.hpp.
Referenced by addEntry(), oid(), removeEntry(), and setOid().