Changeset 6922 for source/ariba


Ignore:
Timestamp:
Nov 13, 2009, 8:05:41 PM (14 years ago)
Author:
mies
Message:

replaced deprecated hash_map, hash_set classes with boost
added unsigned serialization
fixed more warnings
included -Wall to Makefile.am

Location:
source/ariba
Files:
1 added
16 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/Makefile.am

    r6919 r6922  
    2222# compiler flags ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    2323
    24 AM_CPPFLAGS    = -DLINUX -D_LINUX -I../ -D_REENTRANT -DSCTP_KERN
     24AM_CPPFLAGS    = -Wall -Werror -DLINUX -D_LINUX -I../ -D_REENTRANT -DSCTP_KERN
    2525AM_CPPFLAGS    += $(BOOST_CPPFLAGS)
    2626
     
    374374
    375375libariba_la_SOURCES += \
    376   utility/serialization/Serialization.cpp
     376  utility/serialization/Serialization.cpp \
     377  utility/serialization/TestSerialization.cpp
    377378
    378379nobase_libariba_la_HEADERS += \
    379380  utility/serialization/DataUtilities.hpp \
    380381  utility/serialization/Serialization.hpp \
     382  utility/serialization/TestSerialization.h \
    381383  utility/serialization/Data.hpp \
    382384  utility/serialization/DataStream.hpp
  • source/ariba/utility/serialization/Data.hpp

    r6786 r6922  
    4444#include <iostream>
    4545#include <boost/cstdint.hpp>
     46#include <boost/type_traits/make_unsigned.hpp>
    4647
    4748// forward declaration
     
    119120                template<typename X>
    120121                finline void get(X& value, size_t length = sizeof(X) * 8, if_int(X)) const {
    121                         _unsigned(value) = bitget<X> (bits.buffer(), index, length);
     122                        typedef typename boost::make_unsigned<X>::type unsigned_type;
     123                        _unsigned(value) = bitget<unsigned_type> (bits.buffer(), index, length);
    122124                }
    123125
  • source/ariba/utility/serialization/DataStream.hpp

    r6921 r6922  
    543543
    544544                sznMethodBegin(X)
    545                 for (size_t i=0; i<l; i++) X && v[i];
     545                        for (size_t i=0; i<l; i++) X && v[i];
    546546                sznMethodEnd()
    547547        };
  • source/ariba/utility/serialization/TestSerialization.cpp

    r3690 r6922  
    3737// [License]
    3838
     39#include "TestSerialization.h"
    3940#include "Data.hpp"
    4041#include "DataStream.hpp"
     
    5455        Aclass* vclass;
    5556        bool vcls;
     57        uint8_t* static_array;
    5658
    5759        Aclass(bool vcls = false) {
    5860                text = new char[80];
     61                static_array = new uint8_t[20];
     62                for (size_t i=0; i<20; i++) static_array[i] = i;
    5963                strcpy(text, "Hallo!");
    6064                str = "std::string:)";
     
    9498
    9599sznBeginDefault( Aclass, X ){
     100        double xpos;
    96101        X && x && b && I(y,6) && T(text) && T(str) && A(v,4) && I(z) && vcls;
     102        X && static_A(static_array,20);
     103        X && static_A( (uint8_t*)&xpos, 8 );
    97104        if (vcls) X && VO(vclass);
    98105}sznEnd()
     
    100107vsznDefault( Aclass );
    101108
    102 int main() {
     109int test_serialization() {
    103110        using namespace std;
    104111
  • source/ariba/utility/transport/tcpip/protlib/address.h

    r6919 r6922  
    3838#include "ie.h"
    3939
    40 #include <ext/hash_map>
     40#include <boost/unordered_map.hpp>
     41#include <boost/functional/hash.hpp>
     42
    4143#include <netinet/in.h>
    4244#include <set>
     
    14041406/*********************************** hash functions ***********************************/
    14051407
    1406 namespace __gnu_cxx {
     1408namespace boost {
    14071409/// hostaddress hasher
    14081410template <> struct hash<protlib::hostaddress> {
     
    14391441
    14401442/// appladdress equal_to
     1443
    14411444template <> struct equal_to<protlib::appladdress> {
    14421445        inline bool operator()(const protlib::appladdress& addr1, const protlib::appladdress& addr2) const { return addr1.equiv(addr2); }
  • source/ariba/utility/transport/tcpip/protlib/connectionmap.h

    r5284 r6922  
    3131
    3232#include "assocdata.h"
    33 #include <ext/hash_map>
     33#include <boost/unordered_map.hpp>
     34using boost::unordered_map;
    3435
    3536namespace protlib {
     37
     38
    3639
    3740/* @class ConnectionMap
     
    6265                size_t get_size() const;
    6366        private:
    64                 // this hash_map uses the standard hashfunction on the first entry, int
     67                // this unordered_map uses the standard hashfunction on the first entry, int
    6568               
    6669                // only typedefs
    67                 typedef hash_map<socketfd_t ,AssocData*> ass2data_t;
     70                typedef unordered_map<socketfd_t ,AssocData*> ass2data_t;
    6871                typedef ass2data_t::const_iterator const_ass2data_it_t;
    69                 typedef hash_map<appladdress,AssocData*> addr2data_t;
     72                typedef unordered_map<appladdress,AssocData*> addr2data_t;
    7073                typedef addr2data_t::const_iterator const_addr2data_it_t;
    7174
  • source/ariba/utility/transport/tcpip/protlib/connectionmap_uds.cpp

    r5284 r6922  
    3232namespace protlib {
    3333  using namespace log;
     34  using boost::unordered_map;
    3435
    3536/** @ingroup tptcp
  • source/ariba/utility/transport/tcpip/protlib/connectionmap_uds.h

    r5284 r6922  
    3232
    3333#include "assocdata_uds.h"
    34 #include <ext/hash_map>
     34#include <boost/unordered_map.hpp>
    3535
    3636namespace protlib {
     37
     38using boost::unordered_map;
    3739
    3840/* @class ConnectionMap
     
    6365                size_t get_size() const;
    6466        private:
    65                 // this hash_map uses the standard hashfunction on the first entry, int
     67                // this unordered_map uses the standard hashfunction on the first entry, int
    6668               
    6769                // only typedefs
    68                 typedef hash_map<socketfd_t ,AssocDataUDS*> ass2data_t;
     70                typedef unordered_map<socketfd_t ,AssocDataUDS*> ass2data_t;
    6971                typedef ass2data_t::const_iterator const_ass2data_it_t;
    70                 typedef hash_map<udsaddress,AssocDataUDS*> addr2data_t;
     72                typedef unordered_map<udsaddress,AssocDataUDS*> addr2data_t;
    7173                typedef addr2data_t::const_iterator const_addr2data_it_t;
    7274
  • source/ariba/utility/transport/tcpip/protlib/ie.h

    r5284 r6922  
    4545#define _PROTLIB__IE_H_
    4646
    47 #include <ext/hash_map>
     47#include <boost/unordered_map.hpp>
    4848#include <deque>
    4949#include <string>
     
    5353#include "protlib_types.h"
    5454#include "network_message.h"
     55
     56using boost::unordered_map;
    5557
    5658namespace protlib {
     
    463465
    464466  private:
    465         typedef hash_map<IE_Key, IE *, hash_IE_Key> category_map_t;
     467        typedef unordered_map<IE_Key, IE *, hash_IE_Key> category_map_t;
    466468
    467469        category_map_t registry;
  • source/ariba/utility/transport/tcpip/protlib/llhashers.h

    r5284 r6922  
    3131#define PROTLIB_LL_HASHERS_H
    3232
     33#include <boost/functional/hash.hpp>
    3334
    3435/** @addtogroup hashers Hash function objects
     
    4041 */
    4142
    42 namespace __gnu_cxx {
     43namespace boost {
    4344
    4445/// long long int hasher
  • source/ariba/utility/transport/tcpip/protlib/messages.h

    r5284 r6922  
    3737
    3838#include <pthread.h>
    39 #include <ext/hash_set>
     39#include <boost/unordered_set.hpp>
    4040
    4141#include "protlib_types.h"
     
    180180} // end namespace protlib
    181181
    182 namespace __gnu_cxx {
     182namespace boost {
    183183
    184184/// message pointer hasher
  • source/ariba/utility/transport/tcpip/protlib/threads.h

    r5284 r6922  
    4646#define PROTLIB__THREADS_H
    4747
     48#include <vector>
    4849#include <pthread.h>
    4950#include <signal.h>
  • source/ariba/utility/transport/tcpip/protlib/timer.h

    r5284 r6922  
    5151#include <sys/time.h>
    5252#include <list>
    53 #include <ext/hash_map>
     53#include <boost/unordered_map.hpp>
    5454
    5555#include "protlib_types.h"
     
    124124        }; // end struct timer
    125125        /// timer manager hashmap
    126         typedef hash_map<timer_id_t,timer*> timer_hashmap_t;
     126        typedef boost::unordered_map<timer_id_t,timer*> timer_hashmap_t;
    127127        /// hashmap iterator
    128128        typedef timer_hashmap_t::iterator timer_hashmap_it_t;
  • source/ariba/utility/transport/tcpip/protlib/timer_module.h

    r5284 r6922  
    3737#define _PROTLIB__TIMER_MODULE_H
    3838
    39 #include <ext/hash_map>
     39#include <boost/unordered_map.hpp>
    4040
    4141#include "messages.h"
     
    4343#include "llhashers.h"
    4444#include "timer.h"
     45
     46using boost::unordered_map;
    4547
    4648namespace protlib {
     
    248250    void clear(bool dispose = true);
    249251  private:
    250     typedef hash_map<message::id_t,timer_id_t> mid2tid_t;
     252    typedef unordered_map<message::id_t,timer_id_t> mid2tid_t;
    251253    typedef mid2tid_t::const_iterator const_mid2tid_it_t;
    252     typedef hash_map<timer_id_t,message::id_t> tid2mid_t;
     254    typedef unordered_map<timer_id_t,message::id_t> tid2mid_t;
    253255    typedef tid2mid_t::const_iterator const_tid2mid_it_t;
    254     typedef hash_map<timer_id_t,TimerMsg*> tid2msg_t;
     256    typedef unordered_map<timer_id_t,TimerMsg*> tid2msg_t;
    255257    typedef tid2msg_t::const_iterator const_tid2msg_it_t;
    256258    mid2tid_t mid2tid;
  • source/ariba/utility/transport/tcpip/protlib/tp_over_tcp.h

    r5284 r6922  
    3535#define TP_OVER_TCP_H
    3636
    37 #include <ext/hash_map>
     37#include <boost/unordered_map.hpp>
    3838
    3939#include "tp.h"
     
    202202 
    203203  /// store per receiver thread arguments, e.g. for signaling termination
    204   typedef hash_map<pthread_t, receiver_thread_arg_t*> recv_thread_argmap_t;
     204  typedef boost::unordered_map<pthread_t, receiver_thread_arg_t*> recv_thread_argmap_t;
    205205  recv_thread_argmap_t  recv_thread_argmap;
    206206
    207207  /// store sender thread related information
    208   typedef hash_map<appladdress, FastQueue*> sender_thread_queuemap_t;
     208  typedef boost::unordered_map<appladdress, FastQueue*> sender_thread_queuemap_t;
    209209  sender_thread_queuemap_t  senderthread_queuemap;
    210210 
  • source/ariba/utility/transport/tcpip/protlib/tp_over_udp.h

    r5284 r6922  
    3535#define TP_OVER_UDP_H
    3636
    37 #include <ext/hash_map>
     37#include <boost/unordered_map.hpp>
    3838
    3939#include "tp.h"
Note: See TracChangeset for help on using the changeset viewer.