コード例 #1
0
void Vb::set_syntax(const SmiUINT32 syntax)
{
	free_vb(); // setting to SNMP_SYNTAX_NULL

	exception_status = SNMP_CLASS_SUCCESS;

	switch (syntax) {
	case sNMP_SYNTAX_INT32:
	  	iv_vb_value = new SnmpInt32();
		break;
	case sNMP_SYNTAX_TIMETICKS:
		iv_vb_value = new TimeTicks();
		break;
	case sNMP_SYNTAX_CNTR32:
		iv_vb_value = new Counter32();
		break;
	case sNMP_SYNTAX_GAUGE32:
		iv_vb_value = new Gauge32();
		break;
/* Not distinguishable from Gauge32
	case sNMP_SYNTAX_UINT32:
	  	iv_vb_value = new SnmpUInt32();
		break;
*/
	case sNMP_SYNTAX_CNTR64:
	  	iv_vb_value = new Counter64();
		break;
	case sNMP_SYNTAX_BITS:
	case sNMP_SYNTAX_OCTETS:
	  	iv_vb_value = new OctetStr();
		break;
	case sNMP_SYNTAX_OPAQUE:
	  	iv_vb_value = new OpaqueStr();
		break;
	case sNMP_SYNTAX_IPADDR:
	  	iv_vb_value = new IpAddress();
		break;
	case sNMP_SYNTAX_OID:
	  	iv_vb_value = new Oid();
		break;
	case sNMP_SYNTAX_NULL:
		break;
	case sNMP_SYNTAX_NOSUCHINSTANCE:
		exception_status = sNMP_SYNTAX_NOSUCHINSTANCE;
		break;
	case sNMP_SYNTAX_NOSUCHOBJECT:
		exception_status = sNMP_SYNTAX_NOSUCHOBJECT;
		break;
	case sNMP_SYNTAX_ENDOFMIBVIEW:
		exception_status = sNMP_SYNTAX_ENDOFMIBVIEW;
		break;
	case sNMP_SYNTAX_SEQUENCE:
		break;
	}
}
コード例 #2
0
void reach_client::reset_graph(reach_graph *p)
{
    if (pgraph_.get() != p)
    {
        selected_.reset();
        pgraph_.reset(p);
    }

    free_vb(g_desc.vb);
    free_ib(g_desc.ib);
    if (pgraph_->v_count() != 0 && pgraph_->e_count() != 0)
        g_desc = upload_graph(*pgraph_);

}
コード例 #3
0
ファイル: vb.cpp プロジェクト: cunfate/SnmpWithGUI
//---------------[ Vb& Vb::operator=(const Vb &vb) ]--------------------
// overloaded assignment allows assigning one Vb to another
// this involves deep memory thus target vb needs to be freed
// before assigning source
Vb& Vb::operator=(const Vb &vb)
{
  if (this == &vb) return *this;  // check for self assignment

  free_vb(); // free up target to begin with

  //-----[ reassign the Oid portion 1st ]
  vb.get_oid(iv_vb_oid);

  //-----[ next set the vb value portion ]
  if (vb.iv_vb_value)
    iv_vb_value = vb.iv_vb_value->clone();

  exception_status = vb.exception_status;

  return *this; // return self reference
}
コード例 #4
0
ファイル: vb.cpp プロジェクト: CCJY/ACE
//---------------[ Vb& Vb::operator=( const Vb &vb) ]--------------------
// overloaded assignment allows assigning one Vb to another
// this involves deep memory thus target vb needs to be freed
// before assigning source
Vb& Vb::operator=( const Vb &vb)
{
   free_vb();    // free up target to begin with

   //-----[ reassign the Oid portion 1st ]
   vb.get_oid( iv_vb_oid_);

   //-----[ next set the vb value portion ]
   if (vb.iv_vb_value_ == 0) {
     iv_vb_value_ = 0;
   }
   else {
     iv_vb_value_ = vb.iv_vb_value_->clone();
   }
   exception_status_ = vb.exception_status_;

   return *this; // return self reference
}
コード例 #5
0
void reach_client::delete_verts()
{

    double x1 = std::min(square1_.x, square2_.x);
    double y1 = std::min(square1_.y, square2_.y);
    double x2 = std::max(square1_.x, square2_.x);
    double y2 = std::max(square1_.y, square2_.y);


    reach_graph *dst = new reach_graph();

    my_graph::graph_filter<reach_vertex_data, reach_edge_data> filter;
    filter.set_verts_filter([&](my_graph::vertex_id id) -> bool 
    {
        const reach_vertex& v = pgraph_->get_vertex(id);
        const vis_coord &c = v.get_data().c;
        return (c.x >= x1 && c.y >= y1 && c.x <= x2 && c.y <= y2);
    });

    filter.filter_graph(*pgraph_, *dst);
    
    pgraph_.reset(dst);
    free_vb(g_desc.vb);
    free_ib(g_desc.ib);

    g_desc = upload_graph(*pgraph_);

    cout << "saving graph...";
    std::ofstream ofs ("cropped.szd", std::ios_base::out | std::ios_base::binary);
    boost::archive::binary_oarchive ar (ofs);
    ar << *pgraph_;
    cout << "done" << endl;


    selected_.reset();
}
コード例 #6
0
ファイル: vb.cpp プロジェクト: CCJY/ACE
//---------------[ Vb::~Vb() ]------------------------------------------
// destructor
// if the vb has a oid or an octect string then
// the associated memory needs to be freed
Vb::~Vb()
{
  free_vb();
  delete [] output_; // formatting buffer if it exists
}
コード例 #7
0
ファイル: vb.cpp プロジェクト: CCJY/ACE
void Vb::set_value ( const SnmpSyntax &val)
{
  free_vb();
  iv_vb_value_ = val.clone();
}
コード例 #8
0
ファイル: vb.cpp プロジェクト: CCJY/ACE
void Vb::set_value( const Oid& o)
{
  free_vb();
  iv_vb_value_ = (SnmpSyntax *)new Oid(o);
}
コード例 #9
0
ファイル: vb.cpp プロジェクト: CCJY/ACE
void Vb::set_value( const OctetStr& s)
{
  free_vb();
  iv_vb_value_ = (SnmpSyntax *)new OctetStr(s);
}
コード例 #10
0
ファイル: vb.cpp プロジェクト: CCJY/ACE
void Vb::set_value( const TimeTicks& t)
{
  free_vb();
  iv_vb_value_ = (SnmpSyntax *)new TimeTicks(t);
}
コード例 #11
0
ファイル: vb.cpp プロジェクト: CCJY/ACE
void Vb::set_value( const Counter64& c)
{
  free_vb();
  iv_vb_value_ = (SnmpSyntax *)new Counter64(c);
}
コード例 #12
0
ファイル: vb.cpp プロジェクト: CCJY/ACE
void Vb::set_value( const Gauge32& g)
{
  free_vb();
  iv_vb_value_ = (SnmpSyntax *)new Gauge32(g);
}
コード例 #13
0
ファイル: vb.cpp プロジェクト: CCJY/ACE
void Vb::set_value( const SnmpUInt32& u)
{
  free_vb();
  iv_vb_value_ = (SnmpSyntax *)new SnmpUInt32(u);
}
コード例 #14
0
ファイル: vb.cpp プロジェクト: CCJY/ACE
void Vb::set_value( const SnmpInt32& i)
{
  free_vb();
  iv_vb_value_ = (SnmpSyntax *)new SnmpInt32(i);
}
コード例 #15
0
ファイル: vb.cpp プロジェクト: CCJY/ACE
 // set a Vb null, if its not already
void Vb::set_null()
{
   free_vb();
}
コード例 #16
0
reach_client::~reach_client()
{
    free_vb(g_desc.vb);
    free_ib(g_desc.ib);
}