AgentXcpp  Revision:0.1.1
Internals Documentation
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Pages
variable.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2012 Tanjeff-Nicolai Moos <tanjeff@cccmz.de>
3  *
4  * This file is part of the agentXcpp library.
5  *
6  * AgentXcpp is free software: you can redistribute it and/or modify
7  * it under the terms of the AgentXcpp library license, version 1, which
8  * consists of the GNU General Public License and some additional
9  * permissions.
10  *
11  * AgentXcpp is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * See the AgentXcpp library license in the LICENSE file of this package
17  * for more details.
18  */
19 #ifndef _VARIABLE_H_
20 #define _VARIABLE_H_
21 
22 #include "binary.hpp"
23 
24 namespace agentxcpp
25 {
26  /**
27  * \brief This class represents a SNMP variable.
28  *
29  * This class is used as base class for the SNMP variable types (such as
30  * Octet_String or Integer). It has no functions or members exposed to the
31  * API.
32  */
33  class variable
34  {
35  public:
36  /**
37  * \internal
38  *
39  * \brief Serialize the variable.
40  *
41  * This function must be implemented by all derived classes. The
42  * function shall generate a serialized form of the variable.
43  *
44  * \return The serialized form of the variable.
45  *
46  * \exception None: The function shall not throw.
47  */
48  // Needed for encoding varbinds
49  virtual binary serialize() const = 0;
50 
51  /**
52  * \brief Destructor.
53  */
54  virtual ~variable()
55  {
56  }
57 
58  /**
59  * \internal
60  *
61  * \brief Update the internal state of the variable.
62  *
63  * This function must be implemented in derived classes. It shall
64  * update the internal state of the object.
65  *
66  * \exception generic_error If obtaining the new value failed. The
67  * state of such an object cannot be
68  * updated.
69  */
70  virtual void update()=0;
71  };
72 }
73 
74 
75 #endif