// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \mainpage UDP Client/Server example application
-
- \dontinclude udpServer.cc
-
- This Application is a command line based client/server application, which sends some strings from client to server, where they are printed on the command line.
-
- After installing the Library, the udpServer and the udpClient can be found in the senf/Example/udpServer directory and compiled with
-
- <pre>
- #scons -u
- <Then you can start the client/server with>
-
- #./udpServer
- #./udpClient
- </pre>
-
- When we take a look to the code, we start with the Server:
- First we include the necessary headers:
-
- \skip // Custom includes
- \until membind
-
- The Scheduler will be needed because we implement a non blocking UDP Server with the senf integrated Scheduler. The scheduler library provides a simple yet flexible abstraction of the standard asynchronous UNIX mainloop utilizing \c select or \c poll.
-
- \section UDP_serverApplication UDP server application
-
- First we define a class which is responsible for opening a socket and print out the incoming data on stdout.
- We create a \c UDPv4ClientSocketHandle, which is an unconnected and uninitialized UDP (Ipv4) socket.
-
- \until serverSock;
-
- The constructor initialize the Server Object with a given address and port. In our case the server listens static on the loopback device with port 4243.
-
- \until {}
-
- The public \c run() member is called to run the sniffer. It first adds the socket to the Scheduler. The \c add() call takes two Arguments, the socket to bind to (which can be a lot of things and must not necessarily be a socket instance) and callback function to call, whenever there is an event on that socket.The callback is specified as a <a href="http://www.boost.org/doc/html/function.html">Boost.Function</a> object. A third argument may be specified to restrict the events, on which the function is called, here we used the EV_READ Argument, because we just want the program to read from the socket. The default argument is set to \c senf::Scheduler::EV_ALL, which allows all actions on the socket.
-
- \until }
-
- Calling the Schedulers \c process() method will start the event loop. This call does not return (ok, it does return in special cases if \c senf::Scheduler::terminate() is called which does not apply here).
- The Callback Function is the \c readFromClient() Function, which is declared as private here and will be called whenever an event on the socket is encountered. The scheduler passes the event ID to the function.
-
- \until event)
-
- In the function the data from the socket is put into a standard string and dumped out on stdout.
-
- \until };
-
- In the main function we need to create an Object of our Server with the loopback address and the port.
-
- \until return 0;
-
- That's it. We finish of by catching the exception and giving as much detail as possible if an exception is caught. The \c prettyName function from the \c Utils library is used, to get a nice, printable representation of the dynamic type of the exception instance. It is an interface to the g++ demangler. This is necessary since the name member of the C++ \c type_info instance is a mangled name in g++.
-
- \section UDP_clientApplication UDP client application
-
- \dontinclude udpClient.cc
-
- The client application uses the same mechanisms, but implements them in a small main function. It sends numbers as strings to the server.
-
- \skip argv[])
- \until return 0;
-
- First a \c UDPV4CLIENTSOCKETHANDLE is created. With the function \c writeto(senf::INet4SocketAddress, string) the string s will be written to the specified address and port, which is constructed here from a static string \c "127.0.0.1:4243". In this example Integers from zero to ten are send to the Server socket.
-
- The exception handling is again the same as with the server application.
-*/
-
+
+ \dontinclude udpServer.cc
+
+ This Application is a command line based client/server application, which sends some strings from
+ client to server, where they are printed on the command line.
+
+ After installing the Library, the udpServer and the udpClient can be found in the
+ senf/Example/udpServer directory and compiled with
+
+ <pre>
+ #scons -u
+ <Then you can start the client/server with>
+
+ #./udpServer
+ #./udpClient
+ </pre>
+
+ When we take a look to the code, we start with the Server:
+ First we include the necessary headers:
+
+ \skip // Custom includes
+ \until membind
+
+ The Scheduler will be needed because we implement a non blocking UDP Server with the %senf
+ integrated Scheduler. The scheduler library provides a simple yet flexible abstraction of
+ the standard asynchronous UNIX mainloop utilizing \c select or \c poll.
+
+ \section UDP_serverApplication UDP server application
+
+ First we define a class which is responsible for opening a socket and print out the incoming
+ data on stdout. We create a \c UDPv4ClientSocketHandle, which is an unconnected and
+ uninitialized UDP (Ipv4) socket.
+
+ \until serverSock;
+
+ The constructor initialize the Server Object with a given address and port. In our case the
+ server listens static on the loopback device with port 4243.
+
+ \until {}
+
+ The public \c run() member is called to run the sniffer. It first adds the socket to the
+ Scheduler. The \c add() call takes two Arguments, the socket to bind to (which can be a
+ lot of things and must not necessarily be a socket instance) and callback function to call,
+ whenever there is an event on that socket.The callback is specified as a
+ <a href="http://www.boost.org/doc/html/function.html">Boost.Function</a> object. A third
+ argument may be specified to restrict the events, on which the function is called, here we
+ used the EV_READ Argument, because we just want the program to read from the socket.
+ The default argument is set to \c senf::Scheduler::EV_ALL, which allows all actions on the socket.
+
+ \until }
+
+ Calling the Schedulers \c process() method will start the event loop. This call does not
+ return (ok, it does return in special cases if \c senf::Scheduler::terminate() is called which
+ does not apply here). The Callback Function is the \c readFromClient() Function, which is
+ declared as private here and will be called whenever an event on the socket is encountered.
+ The scheduler passes the event ID to the function.
+
+ \until event)
+
+ In the function the data from the socket is put into a standard string and dumped out on stdout.
+
+ \until };
+
+ In the main function we need to create an Object of our Server with the loopback address and the port.
+
+ \until return 0;
+
+ That's it. We finish of by catching the exception and giving as much detail as possible if an
+ exception is caught. The \c prettyName function from the \c Utils library is used, to get a nice,
+ printable representation of the dynamic type of the exception instance. It is an interface to
+ the g++ demangler. This is necessary since the name member of the C++ \c type_info instance is
+ a mangled name in g++.
+
+ \section UDP_clientApplication UDP client application
+
+ \dontinclude udpClient.cc
+
+ The client application uses the same mechanisms, but implements them in a small main function.
+ It sends numbers as strings to the server.
+
+ \skip argv[])
+ \until return 0;
+
+ First a \c UDPv4ClientSocketHandle is created. With the function
+ \c writeto(senf::INet4SocketAddress, string) the string s will be written to the specified
+ address and port, which is constructed here from a static string \c "127.0.0.1:4243". In this
+ example Integers from zero to ten are send to the Server socket.
+
+ The exception handling is again the same as with the server application.
+*/
+
// Local Variables:
// mode: c++
int main(int argc, char const * argv[])
{
- try
- {
- for (int i=0; i<=10; i++)
- {
- senf::UDPv4ClientSocketHandle sock;
- std::stringstream s;
- s << i;
- sock.writeto(senf::INet4SocketAddress("127.0.0.1:4243"),s.str());
- std::cout << i << std::endl;
- }
- }
- catch (std::exception const & ex)
- {
- std::cerr << senf::prettyName(typeid(ex)) << ": " << ex.what() << "\n";
- }
-
- return 0;
+try
+ {
+ for (int i=0; i<=10; i++)
+ {
+ senf::UDPv4ClientSocketHandle sock;
+ std::stringstream s;
+ s << i;
+ sock.writeto(senf::INet4SocketAddress("127.0.0.1:4243"),s.str());
+ std::cout << i << std::endl;
+ }
+ }
+ catch (std::exception const & ex)
+ {
+ std::cerr << senf::prettyName(typeid(ex)) << ": " << ex.what() << "\n";
+ }
+
+ return 0;
}
Server(senf::INet4Address const & host, unsigned int port)
: serverSock(senf::INet4SocketAddress(host, port)) {}
- void run()
- {
- senf::Scheduler::instance().add(serverSock, senf::membind(&Server::readFromClient, this), senf::Scheduler::EV_READ);
- senf::Scheduler::instance().process();
- }
+ void run()
+ {
+ senf::Scheduler::instance().add(
+ serverSock,
+ senf::membind(&Server::readFromClient, this),
+ senf::Scheduler::EV_READ);
+ senf::Scheduler::instance().process();
+ }
private:
- void readFromClient(senf::Scheduler::EventId event)
- {
- std::string data (serverSock.read());
- std::cout << "> " << data<<std::endl ;
- }
+ void readFromClient(senf::Scheduler::EventId event)
+ {
+ std::string data (serverSock.read());
+ std::cout << "> " << data<<std::endl ;
+ }
};
int main(int argc, char const * argv[])
{
- try
- {
- Server testSock(senf::INet4Address::Loopback, 4243);
- testSock.run();
- }
-
- catch (std::exception const & ex) {
+ try {
+ Server testSock(senf::INet4Address::Loopback, 4243);
+ testSock.run();
+ }
+
+ catch (std::exception const & ex) {
std::cerr << senf::prettyName(typeid(ex)) << ": " << ex.what() << "\n";
- }
-
- return 0;
+ }
+ return 0;
}
namespace senf {
namespace ppi {
namespace module {
-
+
class RateFilter
: public Module
{
\pre Requires \a Writer to be copy constructible
\param[in] handle Handle to write data to */
- Writer & writer(); ///< Access the Writer
- Handle & handle(); /**< Access the handle. This is intendet to be mainly used to reconnect the under
- lying socket. */
+ Writer & writer(); ///< Access the Writer
+ Handle & handle(); /**< Access the handle. This is intendet to be mainly used to reconnect
+ the underlying socket. */
/* void reconnect(senf::SocketAddress newAddress);
- ///< Reconnect the handle to which the packets are written
+ ///< Reconnect the handle to which the packets are written
*/
void replaceHandle(Handle newHandle);
/**< Replace the handle to which the packets are written
<< " tunnel_protocol : " << p->tunnel_protocol() << std::endl
;
- //TODO: print included IPs
+ //TODO: print included IPs
}
#undef prefix_
SENF_PARSER_PRIVATE_FIELD ( reserved , UInt8Parser ); //must be zero
SENF_PARSER_VEC_N ( fbiplist, num_of_fbips, INet4AddressParser );
- SENF_PARSER_FINALIZE(DTCPIPv4AddressListParser);
+ SENF_PARSER_FINALIZE(DTCPIPv4AddressListParser);
};
struct DTCPIPv6AddressListParser : public PacketParserBase {
SENF_PARSER_PRIVATE_FIELD ( reserved, UInt8Parser ); //must be zero
SENF_PARSER_VEC_N ( fbiplist, num_of_fbips, INet6AddressParser );
- SENF_PARSER_FINALIZE(DTCPIPv6AddressListParser);
+ SENF_PARSER_FINALIZE(DTCPIPv6AddressListParser);
};
/** \brief Parse a DTCP packet
SENF_PARSER_BITFIELD ( receive_capable_feed, 1, bool ); // 0=send only, 1=receive_capable_feed
SENF_PARSER_BITFIELD_RO ( ip_version, 4, unsigned ); // 4=IPv4, 6=IPv6
SENF_PARSER_FIELD ( tunnel_protocol, UInt8Parser );
- /* Please consider the following comments on the implementation given in this class:
- * 1. you could think of simply using SENF_PARSER_PRIVATE_VARIANT and List / Vectorparser like this:
- * SENF_PARSER_PRIVATE_VARIANT ( fbiplist, ip_version,
+ /* Please consider the following comments on the implementation given in this class:
+ * 1. you could think of simply using SENF_PARSER_PRIVATE_VARIANT and List / Vectorparser like this:
+ * SENF_PARSER_PRIVATE_VARIANT ( fbiplist, ip_version,
* (senf::VoidPacketParser) //ip_version=0
* (senf::VoidPacketParser) //1
* (senf::VoidPacketParser) //2
* (senf::VoidPacketParser) //5
* (senf::ListBParser< IPv6Packet, num_of_fbips>) ); //6
* This can't work for two reasons:
- * -SENF_PARSER_PRIVATE_VARIANT only accepts 6 templates in types but you have to start from 0.
- * -you NEVER can use templated Parsers in these macros since the macro-preprocessor won't recognize the <> brackets and will
- * interpret the ","
+ * -SENF_PARSER_PRIVATE_VARIANT only accepts 6 templates in types but you have to start from 0.
+ * -you NEVER can use templated Parsers in these macros since the macro-preprocessor won't recognize the <> brackets and will
+ * interpret the ","
*
* The first problem is solved by using (actually inventing) SENF_PARSER_VARIANT_TRANS which has the same limitations
- * concerning the number of types but isn't limited to the values used. This is achieved by a translating function
- * as you can see.
+ * concerning the number of types but isn't limited to the values used. This is achieved by a translating function
+ * as you can see.
* The second problem is solved by introducing Helper-Parser which cover both the list and the number field. By that no
- * templates have to be used.
- */
+ * templates have to be used.
+ */
- struct ip_version_translator {
- static unsigned fromChooser(ip_version_t::value_type in) {
- switch (in) {
- case 4: return 0;
- case 6: return 1;
- }
- return 1; //default. should rather throw an exception
- }
- static ip_version_t::value_type toChooser(unsigned in) {
- switch (in) {
- case 0: return 4;
- case 1: return 6;
- }
- return 6; //default. should rather throw an exception
- }
- };
+ struct ip_version_translator {
+ static unsigned fromChooser(ip_version_t::value_type in) {
+ switch (in) {
+ case 4: return 0;
+ case 6: return 1;
+ }
+ return 1; //default. should rather throw an exception
+ }
+ static ip_version_t::value_type toChooser(unsigned in) {
+ switch (in) {
+ case 0: return 4;
+ case 1: return 6;
+ }
+ return 6; //default. should rather throw an exception
+ }
+ };
SENF_PARSER_VARIANT_TRANS ( fbiplist, ip_version, ip_version_translator,
(senf::DTCPIPv4AddressListParser) //IPv4
(senf::DTCPIPv6AddressListParser) ); //IPv6
- DTCPIPv4AddressListParser getIpv4AddressList () const { return fbiplist().get<0>(); } // this is the absolute index
- DTCPIPv6AddressListParser getIpv6AddressList () const { return fbiplist().get<1>(); }
- void setIpVersion4() const { fbiplist().init<0>(); }
- void setIpVersion6() const { fbiplist().init<1>(); }
+ DTCPIPv4AddressListParser getIpv4AddressList () const { return fbiplist().get<0>(); } // this is the absolute index
+ DTCPIPv6AddressListParser getIpv6AddressList () const { return fbiplist().get<1>(); }
+ void setIpVersion4() const { fbiplist().init<0>(); }
+ void setIpVersion6() const { fbiplist().init<1>(); }
- SENF_PARSER_FINALIZE(DTCPPacketParser);
+ SENF_PARSER_FINALIZE(DTCPPacketParser);
};
/** \brief DTCP packet
# include SENF_PARSER()
SENF_PARSER_FIELD ( checksum1_, UInt16Parser );
SENF_PARSER_PRIVATE_FIELD ( reserved1_, UInt16Parser );
- SENF_PARSER_FINALIZE(GREChecksumParser);
+ SENF_PARSER_FINALIZE(GREChecksumParser);
};
struct GREPacketParser : public PacketParserBase
}
if (v < 256u) {
if (bytes() != 2) {
- resize(2);
+ resize(2);
safeThis->extended_length_flag() = true;
- safeThis->fixed_length_field() = 1;
- }
+ safeThis->fixed_length_field() = 1;
+ }
safeThis->parse<UInt8Parser>(1) = v;
return;
}
if (v < 65536u) {
if (bytes() != 3) {
- resize(3);
- safeThis->extended_length_flag() = true;
- safeThis->fixed_length_field() = 2;
- }
+ resize(3);
+ safeThis->extended_length_flag() = true;
+ safeThis->fixed_length_field() = 2;
+ }
safeThis->parse<UInt16Parser>(1) = v;
return;
}
if (v < 16777216u) {
if (bytes() != 4) {
- resize(4);
- safeThis->extended_length_flag() = true;
- safeThis->fixed_length_field() = 3;
- }
+ resize(4);
+ safeThis->extended_length_flag() = true;
+ safeThis->fixed_length_field() = 3;
+ }
safeThis->parse<UInt24Parser>(1) = v;
return;
}
if (v <= 4294967295u) {
if (bytes() != 5) {
- resize(5);
- safeThis->extended_length_flag() = true;
- safeThis->fixed_length_field() = 4;
- }
+ resize(5);
+ safeThis->extended_length_flag() = true;
+ safeThis->fixed_length_field() = 4;
+ }
safeThis->parse<UInt32Parser>(1) = v;
return;
}
BOOST_CHECK_EQUAL( tlvPacket->type(), 42u );
BOOST_CHECK_EQUAL( tlvPacket->length(), payload.size() );
-
+
PacketData & tlvPacket_value2 (tlvPacket.next().data());
- BOOST_CHECK( equal( tlvPacket_value2.begin(), tlvPacket_value2.end(), payload.begin() ));
+ BOOST_CHECK( equal( tlvPacket_value2.begin(), tlvPacket_value2.end(), payload.begin() ));
}
/// @{
typedef MakeSocketPolicy<
- NoAddressingPolicy,
+ NoAddressingPolicy,
DatagramFramingPolicy,
UnconnectedCommunicationPolicy,
ReadablePolicy,
/// @{
typedef MakeSocketPolicy<
- NoAddressingPolicy,
+ NoAddressingPolicy,
DatagramFramingPolicy,
UnconnectedCommunicationPolicy,
NotReadablePolicy,
public RawINetProtocol,
public BSDSocketProtocol,
public AddressableBSDSocketProtocol,
- public MulticastProtocol,
- public INet4MulticastProtocol
+ public MulticastProtocol,
+ public INet4MulticastProtocol
{
public:
///////////////////////////////////////////////////////////////////////////
public RawINetProtocol,
public BSDSocketProtocol,
public AddressableBSDSocketProtocol,
- public MulticastProtocol,
- public INet4MulticastProtocol
+ public MulticastProtocol,
+ public INet4MulticastProtocol
{
public:
///////////////////////////////////////////////////////////////////////////
return;
}
try {
- std::string test = "TEST-WRITE";
+ std::string test = "TEST-WRITE";
alarm(10);
start(server_v4);
senf::RawV4ClientSocketHandle sock(47); //IPPROTO_GRE
BOOST_CHECK_NO_THROW( sock.protocol().sndbuf(2048) );
BOOST_CHECK_EQUAL( sock.protocol().sndbuf(), 2048u );
BOOST_CHECK_NO_THROW( sock.writeto(senf::INet4SocketAddress("127.0.0.1:0"), test) );
- senf::RawV4ClientSocketHandle sockrec(48); //IPPROTO_GRE+1
- std::string in = sockrec.read();
- BOOST_CHECK_EQUAL(in.substr(20), test);
+ senf::RawV4ClientSocketHandle sockrec(48); //IPPROTO_GRE+1
+ std::string in = sockrec.read();
+ BOOST_CHECK_EQUAL(in.substr(20), test);
BOOST_CHECK_NO_THROW( sock.writeto(senf::INet4SocketAddress("127.0.0.1:0"),"QUIT"));
//sock.close();
//sockrec.close();
return;
}
try {
- std::string test = "TEST-WRITE";
+ std::string test = "TEST-WRITE";
alarm(5);
start(server_v6);
sleep(1);
BOOST_CHECK_NO_THROW( sock.protocol().sndbuf(2048) );
BOOST_CHECK_EQUAL( sock.protocol().sndbuf(), 2048u );
BOOST_CHECK_NO_THROW( sock.writeto(senf::INet6SocketAddress("[::1]:0"), test) );
- senf::RawV6ClientSocketHandle sockrec(48); //IPPROTO_GRE+1
- std::string in = sockrec.read();
- BOOST_CHECK_EQUAL(in, test);
+ senf::RawV6ClientSocketHandle sockrec(48); //IPPROTO_GRE+1
+ std::string in = sockrec.read();
+ BOOST_CHECK_EQUAL(in, test);
BOOST_CHECK_NO_THROW( sock.writeto(senf::INet6SocketAddress("[::1]:0"),"QUIT"));
alarm(0);
} catch (...) {
}
prefix_ unsigned senf::UNSocketAddress::sockaddr_len()
- const
+ const
{
return sizeof(addr_);
}
namespace senf {
namespace log {
- /** \brief Write log messages to std::cout
+ /** \brief Write %log messages to std::cout
IOStreamTarget writing to std::cout. This is a singleton target which always exists. Access
it via senf::log::ConsoleTarget::instance()
/////////////////////////////////////////////////////////////////////////////\r
//\r
-// (C) Copyright Ion Gaztañaga 2006-2007\r
+// (C) Copyright Ion Gazta�aga 2006-2007\r
//\r
// Distributed under the Boost Software License, Version 1.0.\r
// (See accompanying file LICENSE_1_0.txt or copy at\r
++local_it_;\r
size_type buckets_len = bucket_info_->buckets_len_;\r
bucket_ptr buckets = bucket_info_->buckets_;\r
- while (local_it_ == islist_from_bucket(buckets[n_bucket_]).end()){\r
- if (++n_bucket_ == buckets_len){\r
- local_it_ = invalid_local_it(*bucket_info_);\r
- break;\r
- }\r
- local_it_ = islist_from_bucket(buckets[n_bucket_]).begin();\r
- }\r
+ while (local_it_ == islist_from_bucket(buckets[n_bucket_]).end()){\r
+ if (++n_bucket_ == buckets_len) {\r
+ local_it_ = invalid_local_it(*bucket_info_);\r
+ break;\r
+ }\r
+ local_it_ = islist_from_bucket(buckets[n_bucket_]).begin();\r
+ }\r
return static_cast<Self&> (*this);\r
}\r
\r
/////////////////////////////////////////////////////////////////////////////\r
//\r
// (C) Copyright Olaf Krzikalla 2004-2006.\r
-// (C) Copyright Ion Gaztañaga 2006-2007\r
+// (C) Copyright Ion Gazta�aga 2006-2007\r
//\r
// Distributed under the Boost Software License, Version 1.0.\r
// (See accompanying file LICENSE_1_0.txt or copy at\r
//! <b>Throws</b>: Nothing.\r
//! \r
//! <b>Complexity</b>: Constant.\r
- reverse_iterator rend() \r
+ reverse_iterator rend()\r
{ return reverse_iterator(begin()); }\r
\r
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end\r
//! <b>Throws</b>: Nothing.\r
//! \r
//! <b>Complexity</b>: Constant.\r
- const_reverse_iterator rend() const \r
+ const_reverse_iterator rend() const\r
{ return const_reverse_iterator(begin()); }\r
\r
//! <b>Effects</b>: Returns the number of the elements contained in the list.\r
template<class BinaryPredicate, class Destroyer>\r
void unique_and_destroy(BinaryPredicate pred, Destroyer destroyer)\r
{\r
- if(!this->empty()){\r
- iterator first = begin();\r
- iterator after = first;\r
- ++after;\r
- while(after != this->end()){\r
- if(pred(*first, *after)){\r
- pointer p = after.operator->();\r
- after = erase(after);\r
- destroyer(p);\r
+ if(!this->empty()) {\r
+ iterator first = begin();\r
+ iterator after = first;\r
+ ++after;\r
+ while(after != this->end()) {\r
+ if(pred(*first, *after)) {\r
+ pointer p = after.operator->();\r
+ after = erase(after);\r
+ destroyer(p);\r
+ }\r
+ else {\r
+ first = after++;\r
+ }\r
}\r
- else{\r
- first = after++;\r
- }\r
- }\r
- }\r
- }\r
+ }\r
+ }\r
\r
//! <b>Requires</b>: value must be a reference to a value inserted in a list.\r
//! \r
/////////////////////////////////////////////////////////////////////////////\r
//\r
// (C) Copyright Olaf Krzikalla 2004-2006.\r
-// (C) Copyright Ion Gaztañaga 2006-2007.\r
+// (C) Copyright Ion Gazta�aga 2006-2007.\r
//\r
// Distributed under the Boost Software License, Version 1.0.\r
// (See accompanying file LICENSE_1_0.txt or copy at\r
x = y_right; // x might be null.\r
}\r
else if(!y_right){ // z has exactly one non-null child. y == z.\r
- x = y_left; // x is not null.\r
+ x = y_left; // x is not null.\r
}\r
else{\r
y = minimum (y_right);\r
- x = NodeTraits::get_right(y); // x might be null.\r
+ x = NodeTraits::get_right(y); // x might be null.\r
}\r
\r
if(y != z){\r
//Since we've found the upper bound there is no other value with the same key if:\r
// - There is no previous node\r
// - The previous node is less than the key\r
- if(!prev || comp(prev, key)){\r
+ if(!prev || comp(prev, key)){\r
commit_data.link_left = left_child;\r
commit_data.node = y;\r
return std::pair<node_ptr, bool>(node_ptr(), true);\r
- }\r
+ }\r
//If the previous value was not less than key, it means that it's equal\r
//(because we've checked the upper bound)\r
else{\r
(const_node_ptr header, node_ptr hint, const KeyType &key\r
,KeyNodePtrCompare comp, insert_commit_data &commit_data)\r
{\r
- //hint must be bigger than the key\r
- if(hint == header || comp(key, hint)){\r
+ //hint must be bigger than the key\r
+ if(hint == header || comp(key, hint)){\r
node_ptr prev = hint;\r
//The previous value should be less than the key\r
- if(prev == NodeTraits::get_left(header) || comp((prev = prev_node(hint)), key)){\r
+ if(prev == NodeTraits::get_left(header) || comp((prev = prev_node(hint)), key)){\r
commit_data.link_left = unique(header) || !NodeTraits::get_left(hint);\r
commit_data.node = commit_data.link_left ? hint : prev;\r
return std::pair<node_ptr, bool>(node_ptr(), true);\r
- }\r
+ }\r
else{\r
return insert_unique_check(header, key, comp, commit_data);\r
//return std::pair<node_ptr, bool>(prev, false);\r
}\r
- }\r
+ }\r
//The hint was wrong, use hintless insert\r
else{\r
return insert_unique_check(header, key, comp, commit_data);\r