Boost logo

Boost Users :

From: Patel Priyank-PPATEL1 (priyankpatel_at_[hidden])
Date: 2006-05-10 12:55:26


Hi Joaquin,
 
Sometime also I get following message when I run. I have pure virtual
method in Procedure.h file but I have
overridden in my Sample_Procedure.h file and implemented there. But
still I am getting error relating pure
virtual method call.
 
Thanks
Priyank
 
 
// PROCEDURE HEADER
 
#ifndef PROCEDURE_H
#define PROCEDURE_H
 
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
#include <ace/Message_Block.h>
#include <ace/Task.h>
#include "Procedure_State_Enum.h"
#include "Procedure_Type_Enum.h"
#include "Loader_Trace.h"
 
class Procedure : boost::noncopyable {
 
public:
 /**
  * Virtual destructor.
  */
 virtual Procedure::~Procedure() {
 }
 /**
  * Stats this procedure.
  * @return Success of failure status of start
  */
 virtual int start() = 0;
 /**
  * Handles this message block. Here we can not use scoped pointer since
  * we have to use release() method that does more than just deleting
the
  * memory allocated.
  * @param _msg_block Message block to handler by procedure.
  * @return Indicates success or failure
  */
 virtual int handle(boost::shared_ptr<ACE_Message_Block> _msg_block) =
0;
 /**
  * Returns state of the procedure.
  * @return Success or failure of the procedure.
  */
 virtual const Procedure_State_Enum& state() const = 0;
 /**
  * Sets state of the procedure.
  * @param state to set
  */
 virtual void state(const Procedure_State_Enum& _state) = 0;
 /**
  * Id for registration with connection.
  * @return Id that is used for registration in subscriber.
  */
 virtual int id() const = 0;
 /**
  * Returns type of the procedure.
  * @return type of the procedure.
  */
 virtual const Procedure_Type_Enum& procedure_type() const = 0;
 /**
  * This method will be called whenever procedure timed out for incoming
  * message. Each procedure will register to appropriate reactor (global
for now) using
  * Procedure Timer Handler class and that class will forward the time
out method back
  * to procedure once time out happens.
  * @param Indicates where timed out handled successfully or not
  */
 virtual void handle_timeout() = 0;
};
 
#endif
 
 
// SAMPLE PROCEDURE HEADER
 
#ifndef SAMPLE_PROCEDURE_H
#define SAMPLE_PROCEDURE_H

#include <boost/utility.hpp>
#include <boost/scoped_ptr.hpp>
#include <ace/Auto_Event.h>
#include <ace/Message_Block.h>
#include "../../../../core/include/Procedure.h"
#include "../../../../core/include/Connection.h"
#include "../../../../core/include/Procedure_Timer_Handler.h"
#include "../../../../core/include/Logger.h"
#include "../../../apps/include/Access_Point.h"
 
class Sample_Procedure : public Procedure {
 
public:
 /**
  * Constructor.
  * @param _ap Access point associated with this procedure.
  * @param _wait_timer Wait period for receiving message
  * may not require for real procedure
  */
 Sample_Procedure (Access_Point * _ap, int _recv_timer);
 /**
  * Start method will be called when this procedure is activated.
  */
 virtual int start();
 /**
  * Returns state this procedure.
  * @return Success or failure of the procedure.
  */
 virtual const Procedure_State_Enum& state () const {
  return state_;
 }
 /**
  * Sets state of the procedure.
  * @param state to set
  */
 virtual void state(const Procedure_State_Enum& _state) {
  state_ = _state;
 }
 /**
  * Returns id for this procedure. This has to be unique id
  * for the procedure.
  */
 virtual int id () const {
  return id_;
 }
 /**
  * Returns type of the procedure.
  * @return type of the procedure.
  */
 virtual const Procedure_Type_Enum& procedure_type() const {
  return type_;
 }
 /**
  * This method will be called whenever procedure timed out for incoming
  * message. Each procedure will register to appropriate reactor (global
for now) using
  * Procedure Timer Handler class and that class will forward the time
out method back
  * to procedure once time out happens.
  */
 virtual void handle_timeout();
 /**
  * Handles this message block. Here we can not use scoped pointer since
  * we have to use release() method that does more than just deleting
the
  * memory allocated.
  * @param _msg_block Message block to handler by procedure.
  * @return Indicates success or failure
  */
 virtual int handle(boost::shared_ptr<ACE_Message_Block> _msg_block);
 static int ID;
 
private:
 /**
  * Access point for which the procedure is related to.
  * This is just a temporary storage. User has to pass
  * each time procedure is created.
  */
 Access_Point* ap_;
 /**
  * State of this procedure.
  */
 Procedure_State_Enum state_;
 /**
  * State of the procedure.
  */
 Procedure_Type_Enum type_;
 /**
  * Wait period to wait.
  */
 int recv_timer_;
 /**
  * Procedure timer handler.
  */
 boost::scoped_ptr<Procedure_Timer_Handler> recv_timer_handler_;
 /**
  * Created static for this samle procedure. Might be regular
  * data member for real procedure.
  */
 int id_;
};
 
#endif
 
 
Thanks,
Priyank
 
LD_TRACE: (8) In
Method: Procedure_Pool::find_by_id File:
`src/core/procedure/Procedure_Pool.cpp' Line: 54
PROCEDURE TO FIND: 1548
pure virtual method called
Abort (core dumped)

 
(gdb) where
#0 0xfe8d9764 in __sigprocmask () from /usr/lib/libthread.so.1
#1 0xfe8ce978 in _resetsig () from /usr/lib/libthread.so.1
#2 0xfe8ce118 in _sigon () from /usr/lib/libthread.so.1
#3 0xfe8d1158 in _thrp_kill () from /usr/lib/libthread.so.1
#4 0xfea4b9dc in raise () from /usr/lib/libc.so.1
#5 0xfea358fc in abort () from /usr/lib/libc.so.1
#6 0xfeb61208 in __cxxabiv1::__terminate (handler=0xfea357f4 <abort>)
    at ../../../../gcc-3.3/libstdc++-v3/libsupc++/eh_terminate.cc:47
#7 0xfeb61244 in std::terminate () at
../../../../gcc-3.3/libstdc++-v3/libsupc++/eh_terminate.cc:57
#8 0xfeb61744 in __cxa_pure_virtual () at
../../../../gcc-3.3/libstdc++-v3/libsupc++/pure.cc:50
#9 0x000ce1d8 in
_ZNK5boost11multi_index13const_mem_funI9ProcedureiXadsrS2_NKS2_2idEvEEcl
ERKS2_ ()
#10 0x000ce174 in
_ZNK5boost11multi_index13const_mem_funI9ProcedureiXadsrS2_NKS2_2idEvEEcl
IPS2_EEiRKT_ ()
#11 0x000ce3e4 in
_ZN5boost11multi_index6detail18ordered_index_findINS1_18ordered_index_no
deINS1_15index_node_baseIP9ProcedureEEEENS0_13const_mem_funIS5_iXadsrS5_
NKS5_2idEvEEEiSt4lessIiEEEPT_SE_RKT0_RKT1_RKT2_ ()
#12 0x000cd72c in
_ZNK5boost11multi_index6detail13ordered_indexINS0_13const_mem_funI9Proce
dureiXadsrS4_NKS4_2idEvEEESt4lessIiENS1_9nth_layerILi1EPS4_NS0_10indexed
_byINS0_14ordered_uniqueINS0_3tagI16procedure_id_tagN4mpl_2naESF_SF_SF_S
F_SF_SF_SF_SF_SF_SF_SF_SF_SF_SF_SF_SF_SF_SF_EES5_SF_EESF_SF_SF_SF_SF_SF_
SF_SF_SF_SF_SF_SF_SF_SF_SF_SF_SF_SF_SF_EESaIS9_EEENS_3mpl6v_itemISD_NSL_
7vector0ISF_EELi0EEENS1_18ordered_unique_tagEE4findIiEENS1_14index_itera
torINS1_18ordered_index_nodeINS1_15index_node_baseIS9_EEEEEERKT_ ()
#13 0x00064d78 in Procedure_Pool::find_by_id ()
#14 0x00064650 in Procedure_Pool::add_by_id ()
#15 0x000783d4 in AP_TCP_Connection::subscribe ()
#16 0x00069d64 in Access_Point::subscribe ()
#17 0x00076450 in Procedure_Executor::handle_timeout ()
#18 0xff2c1940 in
ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Recursive_Thread_Mutex>::tim
eout ()
   from /vob/wibb_test/tools/cots/ACE_5.5/ace/libACE.so.5.5.0
#19 0xff26f2e4 in ACE_TP_Reactor::handle_timer_events ()
    at /mot/proj/ivtools/ppatel1/ACE_wrappers/ace/String_Base.inl:32
#20 0xff26f160 in ACE_TP_Reactor::dispatch_i () at
/mot/proj/ivtools/ppatel1/ACE_wrappers/ace/String_Base.inl:32
---Type <return> to continue, or q <return> to quit---q
Quit
(gdb) quit
 
// METHOD
 
bool Procedure_Pool::find_by_id(Procedure * _procedure)
{
 LD_TRACE("Procedure_Pool::find_by_id");
 ACE_ASSERT(_procedure != 0);
 ACE_DEBUG((LM_DEBUG, "PROCEDURE TO FIND: %d\n", _procedure->id()));
 Procedure_By_Id::iterator it = procedure_by_id_.find(_procedure->id());
 ACE_DEBUG((LM_DEBUG, "AFTER FIND CALL\n"));
 return (it != procedure_by_id_.end());
}



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net