[AGENT++] hidden overloaded virtual function index_allocated() for some shared table demos

Claus Klein claus.klein at arcormail.de
Sun Nov 23 17:12:44 CET 2014


Hi Frank,

I am wondering if it is right that the index_allocated() function is overwritten with different parameters?

There was too a compiler warning about this overloaded virtual function:

agentX++/examples/subagent/src/CMakeFiles/subagent2.dir/if_mib.cpp.o
In file included from /Users/clausklein/Workspace/cpp/AgentProV4/agentX++/examples/subagent/src/agentpp_test_mib.cpp:27:
/Users/clausklein/Workspace/cpp/AgentProV4/agentX++/examples/subagent/src/../include/agentpp_test_mib.h:282:15: warning: 'Agentpp::agentppTestSharedEntry::index_allocated' hides overloaded virtual function [-Woverloaded-virtual]
virtual void index_allocated(const Oidx&, int, int);
             ^
/Users/clausklein/Workspace/cpp/AgentProV4/agentX++/examples/../include/agentx_pp/agentx_subagent.h:243:15: note: hidden overloaded virtual function 'Agentpp::AgentXSharedTable::index_allocated' declared here: different number of parameters (5 vs 3)
virtual void index_allocated(const Oidx&, int, int,
             ^
1 warning generated.


Is this indented?
How does this work?

One of both functions is never called!

Best regards,
Claus


void AgentXSharedTable::index_allocated(const Oidx& ind, int err, int errind,
                                        Vbx* vbs, u_int vbs_length)
{
	if (err == AGENTX_OK) {
		switch (indexStrategy) {
			case anyNonAllocatedSubIndex: {
				Vbx* orig_vbs = create_index_vbs(ind);
				if (!orig_vbs) return;
				for (unsigned int i=0; i<index_len; i++) {
					backReference->get_index_registry()->
					allocate(backReference->get_session()->get_id(),
							 orig_vbs[i], false);
				}
				delete[] orig_vbs;
				break;
			}
			default: break;	//TODO check this! ck
		}
		// default behavior is to add the row when allocation succeeded
		add_row(ind);
	}
	else {
		switch (indexStrategy) {
			case firstSubIndexOnly:
			case anyNonAllocatedSubIndex: {
				if (!vbs) return;
				for (unsigned int i=0; i<vbs_length; i++) {
					backReference->get_index_registry()->
					release(backReference->get_session()->get_id(),
							vbs[i], false);
				}
				delete[] vbs;
				break;
			}
			default: break;	//TODO check this! ck
		}
	}
}


void ifEntry::index_allocated(const Oidx& ind, int err , int errind
		/***TBD***   , Vbx* vbs, u_int vbs_length ***/ )
{
	MibTableRow* n = newRows.removeFirst();
	if (!n) {
		// index reallocated -> reregister it
		add_row(ind);
		return;
	}
	MibTableRow* r = add_row(ind);
	n->set_index(ind);
	n->get_nth(0)->replace_value(new SnmpInt32(ind[0]));
	*r = *n;
	delete n;
}



More information about the AGENTPP mailing list