Class template to implement primitive SNMP variables. More...
#include <Variable.hpp>
Public Member Functions | |
virtual T | get ()=0 |
Handle a Get request. | |
virtual testset_result_t | testset (shared_ptr< T > v) |
Handle a TestSet request. | |
virtual void | cleanupset (shared_ptr< T > v) |
Handle a CleanupSet request. | |
virtual bool | commitset (shared_ptr< T > v) |
Handle a CommitSet request. | |
virtual bool | undoset (shared_ptr< T > v) |
Handle an UndoSet request. | |
![]() | |
virtual | ~AbstractVariable () |
Destructor. |
Additional Inherited Members | |
![]() | |
enum | testset_result_t { noError = 0, genErr = 5, noAccess = 6, wrongType = 7, wrongLength = 8, wrongValue = 10, noCreation = 11, inconsistentValue = 12, resourceUnavailable = 13, notWritable = 17, inconsistentName = 18 } |
Result type for the TestSet validation. More... |
Class template to implement primitive SNMP variables.
This class template is used as base class for primitive SNMP variable implementations. It is instanciated with the value type the variable provides. Then, some functions are overriden to provide the functionality. Example:
The get() method must be implemented. It is not allowed (and not possible) to implement write-only SNMP variables.
To support write access (which is optional), the methods testset() and commitset() must be implemented. The undoset() method should also be implemented in this case. The cleanupset() methon may be implemented if needed.
|
inlinevirtual |
Handle a CleanupSet request.
This method is called to handle an SNMP CleanupSet request. It shall release any ressources allocated by testset().
The default implementation does nothing. If no action is required to perform the CleanupSet operaiton, this method need not be overridden.
v | The new value for the object. |
|
inlinevirtual |
Handle a CommitSet request.
This method is called to handle an SNMP CommitSet request. It shall perform the actual write operation.
The default implementation returns false to indicate that the operation failed. To implement a writable SNMP variable this method must be overridden.
v | The new value for the object. |
|
pure virtual |
Handle a Get request.
This method is called to handle an SNMP Get request. It shall return the current value of the variable.
|
inlinevirtual |
Handle a TestSet request.
This method is called to handle an SNMP TestSet request. It shall check whether a Set operation is possible for the variable. It shall acquire the resources needed to perform the Set operation (but the Set shall not yet performed).
The default implementation returns noAccess to indicate that this is a read-only variable. Thus, for read-only variables this method need not be overridden.
v | The new value for the object. |
|
inlinevirtual |
Handle an UndoSet request.
This method is called to handle an SNMP UndoSet request. It shall undo whatever commitset() performed. It shall also release all resources allocated by testset().
The default implementation returns false to indicate that the operation failed. It is strongly recommended that writable variables override this method.
v | The new value for the object. |