[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[certi-cvs] certi libCERTI/ObjectClass.cc libCERTI/SocketUN...
From: |
certi-cvs |
Subject: |
[certi-cvs] certi libCERTI/ObjectClass.cc libCERTI/SocketUN... |
Date: |
Mon, 12 Oct 2009 07:09:32 +0000 |
CVSROOT: /sources/certi
Module name: certi
Changes by: Eric NOULARD <erk> 09/10/12 07:09:32
Modified files:
libCERTI : ObjectClass.cc SocketUN.cc ObjectSet.cc
TreeNamedAndHandledSet.hh SocketTCP.cc
ObjectClassSet.cc
RTIG : Federation.cc
Log message:
Merge in
patch #6944 : Avoid stringstream instances when not needed
from Mathias.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClass.cc?cvsroot=certi&r1=3.65&r2=3.66
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/SocketUN.cc?cvsroot=certi&r1=3.30&r2=3.31
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectSet.cc?cvsroot=certi&r1=3.24&r2=3.25
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/TreeNamedAndHandledSet.hh?cvsroot=certi&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/SocketTCP.cc?cvsroot=certi&r1=3.28&r2=3.29
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClassSet.cc?cvsroot=certi&r1=3.45&r2=3.46
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federation.cc?cvsroot=certi&r1=3.111&r2=3.112
Patches:
Index: libCERTI/ObjectClass.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClass.cc,v
retrieving revision 3.65
retrieving revision 3.66
diff -u -b -r3.65 -r3.66
--- libCERTI/ObjectClass.cc 14 Sep 2009 21:21:31 -0000 3.65
+++ libCERTI/ObjectClass.cc 12 Oct 2009 07:09:32 -0000 3.66
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: ObjectClass.cc,v 3.65 2009/09/14 21:21:31 erk Exp $
+// $Id: ObjectClass.cc,v 3.66 2009/10/12 07:09:32 erk Exp $
// ----------------------------------------------------------------------------
#include "Object.hh"
@@ -540,21 +540,20 @@
ObjectClass::getInstanceWithID(ObjectHandle the_id) const
throw (ObjectNotKnown)
{
- std::stringstream msg;
-
list<Object *>::const_iterator o ;
for (o = objectSet.begin(); o != objectSet.end(); o++) {
if ((*o)->getHandle() == the_id)
return (*o);
}
+ std::stringstream msg;
msg << "Could not find ObjectHandle <" << the_id << "> among <"
<< objectSet.size() << "> objects of ObjectClass "
<< handle;
D[pdError] << msg.str().c_str() << std::endl ;
- throw ObjectNotKnown(msg.str().c_str());
+ throw ObjectNotKnown(msg.str());
}
// ----------------------------------------------------------------------------
@@ -1835,4 +1834,4 @@
} // namespace certi
-// $Id: ObjectClass.cc,v 3.65 2009/09/14 21:21:31 erk Exp $
+// $Id: ObjectClass.cc,v 3.66 2009/10/12 07:09:32 erk Exp $
Index: libCERTI/SocketUN.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/SocketUN.cc,v
retrieving revision 3.30
retrieving revision 3.31
diff -u -b -r3.30 -r3.31
--- libCERTI/SocketUN.cc 14 Sep 2009 20:51:52 -0000 3.30
+++ libCERTI/SocketUN.cc 12 Oct 2009 07:09:32 -0000 3.31
@@ -41,7 +41,6 @@
#include <iostream>
#include <assert.h>
-using std::ostringstream ;
using std::string ;
using std::cout ;
using std::endl ;
Index: libCERTI/ObjectSet.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectSet.cc,v
retrieving revision 3.24
retrieving revision 3.25
diff -u -b -r3.24 -r3.25
--- libCERTI/ObjectSet.cc 14 Sep 2009 21:21:31 -0000 3.24
+++ libCERTI/ObjectSet.cc 12 Oct 2009 07:09:32 -0000 3.25
@@ -97,16 +97,15 @@
ObjectSet::getObjectInstanceHandle(std::string the_name) const
throw (ObjectNotKnown, RTIinternalError)
{
- std::stringstream msg;
-
std::map<ObjectHandle, Object *>::const_iterator i ;
for (i = begin(); i != end(); i++) {
if (i->second->getName() == the_name)
return i->second->getHandle();
}
+ std::stringstream msg;
msg << "No object instance with name <" << the_name;
- throw ObjectNotKnown(msg.str().c_str());
+ throw ObjectNotKnown(msg.str());
}
// ----------------------------------------------------------------------------
@@ -462,4 +461,4 @@
}
} // namespace certi
-// $Id: ObjectSet.cc,v 3.24 2009/09/14 21:21:31 erk Exp $
+// $Id: ObjectSet.cc,v 3.25 2009/10/12 07:09:32 erk Exp $
Index: libCERTI/TreeNamedAndHandledSet.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/TreeNamedAndHandledSet.hh,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- libCERTI/TreeNamedAndHandledSet.hh 15 Nov 2008 14:54:26 -0000 1.8
+++ libCERTI/TreeNamedAndHandledSet.hh 12 Oct 2009 07:09:32 -0000 1.9
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: TreeNamedAndHandledSet.hh,v 1.8 2008/11/15 14:54:26 gotthardp Exp $
+// $Id: TreeNamedAndHandledSet.hh,v 1.9 2009/10/12 07:09:32 erk Exp $
// ----------------------------------------------------------------------------
#ifndef _TreeNamedAndHandledSet_HH
@@ -207,7 +207,6 @@
TreeNamedAndHandledSet<ObjectType>::add(ObjectType *child, ObjectType *parent)
throw (RTIinternalError) {
typename Name2ObjectMap_t::iterator findit;
- std::stringstream msg;
/* build hierarchical name if a parent is given */
if (NULL!=parent) {
@@ -237,13 +236,14 @@
*/
findit = fromName.find(child->getName());
if (findit != fromName.end()) {
+ std::stringstream msg;
msg << "Name collision another object class named <"
<< child->getName()
<< "> with handle <"
<< findit->second->getHandle()
<< "> was found when trying to add identically named object class
with handle <"
<< child->getHandle();
- throw RTIinternalError(msg.str().c_str());
+ throw RTIinternalError(msg.str());
}
/* store ref to new object in Object from Handle Map */
fromHandle[child->getHandle()] = child;
@@ -303,7 +303,7 @@
}
/* every search has failed */
- throw NameNotFound(name.c_str());
+ throw NameNotFound(name);
} /* end of getObjectClassHandle */
template <typename ObjectType>
@@ -319,7 +319,6 @@
TreeNamedAndHandledSet<ObjectType>::getObjectFromHandle(HandleType handle)
const
throw (ObjectNotDefinedException) {
- std::stringstream msg;
handled_const_iterator iter;
iter = fromHandle.find(handle);
@@ -327,8 +326,9 @@
if (iter != fromHandle.end()) {
return iter->second;
} else {
+ std::stringstream msg;
msg << "Unknown Object Handle <" << handle << ">";
- throw ObjectNotDefinedException(msg.str().c_str());
+ throw ObjectNotDefinedException(msg.str());
}
} /* end of getObjectFromHandle */
Index: libCERTI/SocketTCP.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/SocketTCP.cc,v
retrieving revision 3.28
retrieving revision 3.29
diff -u -b -r3.28 -r3.29
--- libCERTI/SocketTCP.cc 4 Jun 2009 11:58:51 -0000 3.28
+++ libCERTI/SocketTCP.cc 12 Oct 2009 07:09:32 -0000 3.29
@@ -17,7 +17,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: SocketTCP.cc,v 3.28 2009/06/04 11:58:51 erk Exp $
+// $Id: SocketTCP.cc,v 3.29 2009/10/12 07:09:32 erk Exp $
// ----------------------------------------------------------------------------
#ifdef _WIN32
@@ -180,7 +180,6 @@
// ----------------------------------------------------------------------------
int SocketTCP::accept(SocketTCP *serveur) throw (NetworkError)
{
- std::stringstream msg;
struct protoent *TCPent ;
int optval = 1 ;
@@ -198,9 +197,10 @@
_socket_tcp = ::accept(serveur->_socket_tcp, (sockaddr*)&_sockIn, &l);
if (_socket_tcp < 0)
{
+ std::stringstream msg;
msg << "SocketTCP: Accept Failed"
<< "<" << strerror(errno) <<">";
- throw NetworkError(msg.str().c_str());
+ throw NetworkError(msg.str());
}
// Set the TCP_NODELAY option(Server Side)
@@ -264,18 +264,18 @@
SocketTCP::createConnection(const char *server_name, unsigned int port)
throw (NetworkError)
{
- std::stringstream msg;
// get host information from server name
// this may perform DNS query
struct hostent *hptr = gethostbyname(server_name);
if (NULL == hptr)
{
+ std::stringstream msg;
msg << "gethostbyname gave NULL answer for hostname <"
<< server_name
<< "> with error <"
<< strerror(errno)
<< ">";
- throw NetworkError(msg.str().c_str());
+ throw NetworkError(msg.str());
}
in_addr_t addr = 0;
@@ -290,21 +290,22 @@
throw (NetworkError)
{
assert(!_est_init_tcp);
-std::stringstream msg;
if (!open())
{
+ std::stringstream msg;
msg << "Cannot open port <" << port
<< "> on addr <" << addr2string(addr)
<< "> : error =" << strerror(errno);
- throw NetworkError(msg.str().c_str());
+ throw NetworkError(msg.str());
}
if (!connect(port, addr))
{
+ std::stringstream msg;
msg << "Cannot connect port <" << port
<< "> on addr <" << addr2string(addr)
<< "> : error =" << strerror(errno);
- throw NetworkError(msg.str().c_str());
+ throw NetworkError(msg.str());
}
_est_init_tcp = true ;
@@ -315,32 +316,34 @@
SocketTCP::createTCPServer(in_port_t port, in_addr_t addr)
throw (NetworkError)
{
- std::stringstream msg;
assert(!_est_init_tcp);
if (!open())
{
+ std::stringstream msg;
msg << "Cannot open port <" << port
<< "> on addr <" << addr2string(addr)
<< "> : error =" << strerror(errno);
- throw NetworkError(msg.str().c_str());
+ throw NetworkError(msg.str());
}
if (!bind(port, addr))
{
+ std::stringstream msg;
msg << "Cannot bind port <" << port
<< "> on addr <" << addr2string(addr)
<< "> : error =" << strerror(errno);
- throw NetworkError(msg.str().c_str());
+ throw NetworkError(msg.str());
}
if (!listen(MAX_BACKLOG))
{
+ std::stringstream msg;
msg << "Cannot listen port <" << port
<< "> on addr <" << addr2string(addr)
<< "> : error =" << strerror(errno);
- throw NetworkError(msg.str().c_str());
+ throw NetworkError(msg.str());
}
_est_init_tcp = true ;
@@ -596,4 +599,4 @@
} // namespace
-// $Id: SocketTCP.cc,v 3.28 2009/06/04 11:58:51 erk Exp $
+// $Id: SocketTCP.cc,v 3.29 2009/10/12 07:09:32 erk Exp $
Index: libCERTI/ObjectClassSet.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClassSet.cc,v
retrieving revision 3.45
retrieving revision 3.46
diff -u -b -r3.45 -r3.46
--- libCERTI/ObjectClassSet.cc 8 Nov 2008 11:36:05 -0000 3.45
+++ libCERTI/ObjectClassSet.cc 12 Oct 2009 07:09:32 -0000 3.46
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: ObjectClassSet.cc,v 3.45 2008/11/08 11:36:05 erk Exp $
+// $Id: ObjectClassSet.cc,v 3.46 2009/10/12 07:09:32 erk Exp $
// ----------------------------------------------------------------------------
// Project
@@ -32,12 +32,10 @@
#include "Named.hh"
// Standard
-#include <iostream>
+#include <iosfwd>
#include <sstream>
-#include <assert.h>
using std::list ;
-using std::cout ;
using std::endl ;
using std::string ;
@@ -218,17 +216,16 @@
ObjectClassSet::getInstanceClass(ObjectHandle theObjectHandle) const
throw (ObjectNotKnown)
{
- std::stringstream msg;
-
handled_const_iterator i ;
for (i = fromHandle.begin(); i != fromHandle.end(); ++i) {
if (i->second->isInstanceInClass(theObjectHandle) == true)
return (i->second);
}
+ std::stringstream msg;
msg << "ObjectHandle <" << theObjectHandle <<"> not found in any object
class.";
D.Out(pdExcept, msg.str().c_str());
- throw ObjectNotKnown(msg.str().c_str());
+ throw ObjectNotKnown(msg.str());
}
// ----------------------------------------------------------------------------
@@ -238,7 +235,6 @@
ObjectClassSet::getObject(ObjectHandle h) const
throw (ObjectNotKnown)
{
-
handled_const_iterator i ;
for (i = fromHandle.begin(); i != fromHandle.end(); ++i) {
@@ -696,4 +692,4 @@
} // namespace certi
-// $Id: ObjectClassSet.cc,v 3.45 2008/11/08 11:36:05 erk Exp $
+// $Id: ObjectClassSet.cc,v 3.46 2009/10/12 07:09:32 erk Exp $
Index: RTIG/Federation.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/Federation.cc,v
retrieving revision 3.111
retrieving revision 3.112
diff -u -b -r3.111 -r3.112
--- RTIG/Federation.cc 9 Oct 2009 21:13:56 -0000 3.111
+++ RTIG/Federation.cc 12 Oct 2009 07:09:32 -0000 3.112
@@ -18,7 +18,7 @@
// along with this program ; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// $Id: Federation.cc,v 3.111 2009/10/09 21:13:56 erk Exp $
+// $Id: Federation.cc,v 3.112 2009/10/12 07:09:32 erk Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -1439,15 +1439,14 @@
Federation::getFederate(const char *federate_name)
throw (FederateNotExecutionMember)
{
- std::stringstream msg;
-
for (FederateList::iterator i = federates.begin(); i != federates.end();
++i) {
if (strcmp(i->getName(), federate_name) == 0)
return *i ;
}
+ std::stringstream msg;
msg << "Federate <"<<federate_name<<"> not [yet] member of Federation <"
<< getName() <<">.";
- throw FederateNotExecutionMember(msg.str().c_str());
+ throw FederateNotExecutionMember(msg.str());
}
// ----------------------------------------------------------------------------
@@ -2591,5 +2590,5 @@
}} // namespace certi/rtig
-// $Id: Federation.cc,v 3.111 2009/10/09 21:13:56 erk Exp $
+// $Id: Federation.cc,v 3.112 2009/10/12 07:09:32 erk Exp $
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [certi-cvs] certi libCERTI/ObjectClass.cc libCERTI/SocketUN...,
certi-cvs <=