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... | |
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. |
bool Table::contains | ( | QSharedPointer< TableEntry > | entry | ) | const |
Check whether the table contains a given entry.
entry | The entry to search for. |
None. |
|
inline |
Get the MasterProxy object associated with this table.
None. |
|
inline |
Get the table's OID.
None. |
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. |
|
inline |
Set the MasterProxy object used by this table.
master | The new MasterProxy object. |
None. |
|
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. |