ircproxy  The Ultimate Cyborg

UserAnswerEventRequestBase Class Reference

#include <UserAnswer.h>

Inheritance diagram for UserAnswerEventRequestBase:

List of all members.


Detailed Description

Base class for UserAnswer event request objects.

Definition at line 97 of file UserAnswer.h.


Public Types

typedef UserAnswerRequestData event_request_data_ct
 The type of the request data.

Public Member Functions

 UserAnswerEventRequestBase (event_client_tracker_ct *event_client_tracker, event_request_data_ct request_data)
 Construct a UserAnswerEventRequestBase.
 ~UserAnswerEventRequestBase ()
 Destruct UserAnswerEventRequestBase.
 UserAnswerEventRequestBase (UserAnswerEventRequestBase const &request)
 Copy constructor.
boost::shared_ptr< Target > const & target (void) const
 Returns the target.

Private Attributes

event_request_data_ct M_request_data
 The request data.
boost::shared_ptr< TargetM_target
 The target.

Friends

std::ostream & operator<< (std::ostream &os, UserAnswerEventRequestBase const &request)
 Write UserAnswerEventRequestBase request to os.

Member Typedef Documentation

The type of the request data.

Definition at line 100 of file UserAnswer.h.


Constructor & Destructor Documentation

UserAnswerEventRequestBase::UserAnswerEventRequestBase ( event_client_tracker_ct *  event_client_tracker,
event_request_data_ct  request_data 
)

Construct a UserAnswerEventRequestBase.

Definition at line 42 of file UserAnswer.cc.

References UserAnswerRequestData::client_session(), M_request_data, M_target, debug::channels::dc::objects, question_target_name(), and UserAnswerRequestData::user_question().

00043                                         :
00044     event_request_base_tct<UserAnswerEventType>(event_client_tracker), M_request_data(request_data)
00045 {
00046   Dout(dc::objects, "Constructing UserAnswerEventRequestBase(" << request_data << ")");
00047 
00048   ClientSession& client_session(M_request_data.client_session());
00049 
00050   std::string target_name = question_target_name(request_data.user_question()->number());
00051   ClientSession::private_targets_type::iterator priv_iter = client_session.private_targets().find(target_name);
00052   if (priv_iter != client_session.private_targets().end())
00053     M_target = priv_iter->second;
00054   else
00055   {
00056     M_target.reset(new QuestionTarget(client_session, target_name, client_session.identity().private_network()));
00057     client_session.add_private_target(M_target);
00058   }
00059   boost::static_pointer_cast<QuestionTarget>(M_target)->set_user_question(request_data.user_question());
00060   boost::static_pointer_cast<QuestionTarget>(M_target)->create_channel_and_ask_question();
00061 }

UserAnswerEventRequestBase::~UserAnswerEventRequestBase (  ) 

Destruct UserAnswerEventRequestBase.

Definition at line 64 of file UserAnswer.cc.

References M_target, and debug::channels::dc::objects.

00065 { 
00066   Dout(dc::objects, "Destructing UserAnswerEventRequestBase " << *this);
00067   boost::static_pointer_cast<QuestionTarget>(M_target)->reset_user_question();
00068 }

UserAnswerEventRequestBase::UserAnswerEventRequestBase ( UserAnswerEventRequestBase const &  request  )  [inline]

Copy constructor.

Definition at line 108 of file UserAnswer.h.

References debug::channels::dc::objects.

00108                                                                         :
00109       event_request_base_tct<UserAnswerEventType>(request),
00110       M_request_data(request.M_request_data),
00111       M_target(request.M_target)
00112       { Dout(dc::objects, "Copy-constructing UserAnswerEventRequestBase from " << request); }


Member Function Documentation

boost::shared_ptr<Target> const& UserAnswerEventRequestBase::target ( void   )  const [inline]

Returns the target.

Definition at line 115 of file UserAnswer.h.

References M_target.

00115 { return M_target; }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
UserAnswerEventRequestBase const &  request 
) [friend]

Write UserAnswerEventRequestBase request to os.

Definition at line 285 of file debug_ostream_operators.cc.

00286 {
00287   os << "{request_data:" << request.M_request_data;
00288   if (request.M_target.get())
00289     os << ", target:" << *request.M_target.get();
00290   return os << '}';
00291 }


Member Data Documentation

The request data.

Definition at line 102 of file UserAnswer.h.

Referenced by operator<<(), and UserAnswerEventRequestBase().

boost::shared_ptr<Target> UserAnswerEventRequestBase::M_target [private]

The target.

Definition at line 103 of file UserAnswer.h.

Referenced by operator<<(), target(), UserAnswerEventRequestBase(), and ~UserAnswerEventRequestBase().


The documentation for this class was generated from the following files:

Copyright © 2005-2007 Carlo Wood.  All rights reserved.