I am parsing below sample file in below code snippet. {"requestType":"INVOCATION", "hostName":"localhost", "serviceName":"bucky", "serviceType":"DISCRETE", "serviceParameters":"sampleData", "servicesList" :[ { "serviceName" : "ABC", "serviceParameters" : {"para1" : "value1", "para2" : "value2", "para3" : "value3"} }, {"serviceName" : "CBA", "serviceParameters" : { "para1" : "value90", "para2" : "value", "para3" : "value"} } ], "dataTransferMode":null } code snippet: #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/json_parser.hpp> #include <sstream> #include <iostream> #include <boost/foreach.hpp> #include <map> using boost::property_tree::ptree; using namespace std; void print(boost::property_tree::ptree const& pt,vector <string> &service_list, map <string,string> &service_param) { using boost::property_tree::ptree; ptree::const_iterator end = pt.end(); string value; for (ptree::const_iterator it = pt.begin(); it != end; ++it) { //cout<<it->first<<":"<<it->second.get_value<std::string>()<<endl; …

Member Avatar
Member Avatar
+0 forum 2

In below code i am writing file contents in backup serialize file through boost serialization library, but what i observed that every time i need to store all the data in file then only i would be able to read the entire data. so in case if i perform single write operation and just try to get the store data in backup file then not able to read anything stored in backup file as it looks like old contents were not present in the file . After executing entire code i am able to read the serialize map from file …

Member Avatar
Member Avatar
+0 forum 2

I'm trying to develop an app that realises the communication between a gameserver and an applcation. My code so far is: #include <cstdlib> #include <iostream> #include <boost/bind.hpp> #include <boost/asio.hpp> #include <boost/asio/ssl.hpp> using namespace std; enum { max_length = 1024 }; class client { public: boost::asio::streambuf receive_buffer; client(boost::asio::io_service& io_service, boost::asio::ssl::context& context, boost::asio::ip::tcp::resolver::iterator endpoint_iterator) : socket_(io_service, context) { socket_.set_verify_mode(boost::asio::ssl::verify_peer); socket_.set_verify_callback( boost::bind(&client::verify_certificate, this, _1, _2)); boost::asio::async_connect(socket_.lowest_layer(), endpoint_iterator, boost::bind(&client::handle_connect, this, boost::asio::placeholders::error)); } bool verify_certificate(bool preverified, boost::asio::ssl::verify_context& ctx) { char subject_name[256]; X509* cert = X509_STORE_CTX_get_current_cert(ctx.native_handle()); X509_NAME_oneline(X509_get_subject_name(cert), subject_name, 256); return preverified; } void handle_connect(const boost::system::error_code& error) { if (!error) { socket_.async_handshake(boost::asio::ssl::stream_base::client, boost::bind(&client::handle_handshake, this, boost::asio::placeholders::error)); } else …

Member Avatar
Member Avatar
+0 forum 1

Is there any program for boosting my headphones i have searched on internet but all i get is the same steps (right click on volume>Playback Devices > Properties>Enhacements> Enable Sound Equalizer)

Member Avatar
Member Avatar
+0 forum 6

Hi, I have the following map : listOfPolicyRuleInfo CPCRF::m_mlistOfCliConfiguredPolicyRules; where typedef map<string, PolicyRuleInfo> listOfPolicyRuleInfo; where PolicyRuleInfo is a struct struct PolicyRuleInfo{ BearerQoSInfo stBearerQoS; TFTInfo stTFTInfo; PolicyRuleInfo(){}; PolicyRuleInfo( BearerQoSInfo const& qos, TFTInfo const& tft) : stBearerQoS(qos), stTFTInfo(tft) { } }; listOfPolicyRuleInfo m_mlistOfCliConfiguredPolicyRules = boost::assign::map_list_of("PolicyRule_Fred", PolicyRuleInfo( BearerQoSInfo(9), TFTInfo())) ("PolicyRule_Voice_C", PolicyRuleInfo( BearerQoSInfo(5), TFTInfo())) ("PolicyRule_Voice_U", PolicyRuleInfo( BearerQoSInfo(1), TFTInfo())); Above are the data strutures. Now within the code somewhere , listOfPolicyRuleInfo::iterator it = m_mlistOfCliConfiguredPolicyRules.find("PolicyRule_Fred"); I get error when i try to print the contents of it. on gdb i see the list (gdb)p m_mlistOfCliConfiguredPolicyRules ["PolicyRule_Fred"] = {stBearerQoS = {nQCI = 9, nMaxUlBitRate = 0, nMaxDlBitRate …

Member Avatar
Member Avatar
+0 forum 3

The problem is that i can't manage to compile the simplest (int main(){}) boost asio program with Code Blocks. I'm using Windows 7. Googling gave me some controversial suggestions: 1) to add -lwsock32 key - Done(Compiler settings->Other options-> -lwsock32) 2) to link with ws2_32.dll and wsock32.dll - Done (Linker settings->paths to these dlls) 3) to link with boost system lib - Done(Linker settings -> path to libboost_system-mgw47-mt-1_52.a) 4) to add _WIN32_WINNT=0x0601 for Windows 7 option - Done (Compiler settings->#defines _WIN32_WINNT=0x0601) 5) to include winsocks2.h as a header - Done. 6) to add option -std=gnu++11 - Done And still it doesn't …

Member Avatar
Member Avatar
+0 forum 2

Hi Kind-DaniWebbers, How do you initialise a boost::archive:binary_oarchive in a different place to where you declare it? So: class CBase { std::ofstream m_ofs; boost::archive:binary_oarchive m_binOA(); // <== default constructor virtual void Open(std::string& s) = delete; }; class CDerived : CBase { void Open(std::string& s) override { CBase::m_ofs("filename.bin", std::ios::binary); CBase::m_binOA(CBase::m_ofs, /*flags*/); // <== says error C2660: '...'::m_binOA' : // function does not take 2 arguments } }; I am trying to create different interfaces for XML, TXT and BIN. So I just derive from the one I want. Is this the way to do it? I struggling to design this. Please …

Member Avatar
Member Avatar
+0 forum 1

Hello, I am currently trying to use boost asio for IPC. I ran into 2 strange issues: 1) when using the acceptor class, when I bring my process up, I get the error 'Already open' when trying to listen. The port I am trying to bind to is definitely not being used by another process. This only happens for a couple of my processes (others work fine). 2) when trying to establish a connection to a server (one that works fine from above), both processes receive the connection (and also disconnection when I kill one), but when I try to …

Member Avatar
Member Avatar
+0 forum 3

I've implimented this snippet of code dijkstra_shortest_paths( g, name2v[tempName1], get(&VertexProperty::predecessor, g), get(&VertexProperty::distance, g), get(&EdgeProperty::weight, g), boost::identity_property_map(), // index-map std::less<double>(), // compare std::plus<double>(), // combine std::numeric_limits<double>::infinity(), // infinity 0.0, // zero do_nothing_dijkstra_visitor(), get(&VertexProperty::color, g)); to use dijkstra's on a map created from a text file, but I have no idea how to output the vertex I start at to the next one required to be visited and the distance between them repeatedly followed by the total distance traveled. I can post any part of the code to assists with this. I think this may be required, this is what I used …

Member Avatar
Member Avatar
+0 forum 41

I currently have a program that can take a text file and inport the data that I need (names or locations as well as the distances between them) and I need to take that data and for a graph in boost so that I can do one of three things, use Dijkstra’s to find the shortest path between two nodes, use a minimum spanning tree to figure out the shortest way to connect every node, and how to visit every node only once on the shortest path. I import the data as follows: std::getline(fin, tempString); //Location1, Location2, ... std::stringstream tempSS(tempString); …

Member Avatar
+0 forum 0

I have 2 processes (producer and consumer) sharing an int deque in shared memory, I have the producer process put 2 numbers in the deque and then it gets in a wait state losing its mutex lock. I then have the consumer process removing the numbers and printing them. It then does a notify on the condition which the producer is waiting on. The consumer then goes on its own wait on a second condition. After this case the producer does not wake up. I am using the same mutex between the processes. Please find all code below. Include file …

Member Avatar
Member Avatar
+0 forum 2

Hello everyone, New here to the forum. Just wanted to introduce my business to the community: ThousandLikes.com . We offer solutions to increase social presense of your business. We offer your facebook page fans, youtube video views, twitter followers. Happy to be part of the community. Drop me an e-mail anytime if you're interested in our services - the e- mail is on the website. Thanks and looking forward to hearing from you. Have a great day.

Member Avatar
Member Avatar
+0 forum 1

My laptop has only 257MB RAM, so it does works soo slowly, it always hangs, I heard that windows users can increase RAM space with pendrive... I know it works windows 7 but does it work in XP ?? and Does hardrive memory also slow down your computer ?

Member Avatar
Member Avatar
+0 forum 3

0 down vote favorite I have a huge vector of boost dynamic_bitset. I want to write the dynamic_bitset vector to a file and later read the file back into a dynamic_bitset vector. Is the memory for dynamic_bitset allocated as a contiguous block of memory (so that I can write the entire vector at once without traversing) ? The size of the bitset vector is in order of millions. So I am looking for an efficient way to write them to a file instead of iterating through the elements. I converted the dynamic_bitset to a string and then wrote the string …

Member Avatar
Member Avatar
+0 forum 3

Hey all, I usuallly don't like asking for help on these sites but I have been kicking myself for a while now implementing boost regex for a program (i have never had any prior issues). I believe the issue is with my regex syntax but i have tried numerous variations and have yet to have a successful run. It looks like: scrape(game, "<some-tag>(.*?)</some-tag>", 1); fairly simple. the scrape function is a public function for a handler class i made which is implemented like: std::string my_class::scrape(const std::string &base, const std::string &match, const int &set) { boost::regex re(match); boost::smatch matches; if(boost::regex_search(base, matches, …

Member Avatar
Member Avatar
+0 forum 4

Hello I'm trying to read files of file extension .obj or .txt and for certain characters using boost iostreams How would I implement that using this current code as a basis [CODE] typedef ex::container_source<string> string_source; string input = "hello"; string output; io::stream<string_source> in(input); getline(in, output); assert(input == output); cout << output << endl;[/CODE] any help would be great thanks I've read the documentation but can't find anything really usefull for this kind of thing prehaps one of you out there can give me a helping hand

Member Avatar
Member Avatar
+0 forum 1

I need helping trying to retrieve data held in a [CODE]std::list<boost::shared_ptr<boost::any>>[/CODE] I am working on a Singleton Controller class with a private [B]std::list[/B]. Client class(es) will be able to [B]Add/Remove/Edit[/B] concrete class objects to be used by the program through this Controller class. The reason for using [B]boost::shared_ptr[/B] is because I assign a unique objID to each concrete class created. Once instance objs are added to controller, user will be able to search and remove objs later. The [B]Add(....)[/B] and [B]Remove(...)[/B] overloaded methods for each concrete class work fine. I am now trying to create [B]getObject(int index)[/B] and [B]setObject(int index)[/B] …

Member Avatar
Member Avatar
+0 forum 2

Hi, I have a problem with linking boost libraries in codeblocks using gcc 4.6.1. I'm getting following errors: undefined reference to `vtable for boost::unit_test::unit_test_log_t' How can I solve it?

Member Avatar
Member Avatar
+0 forum 2

Hey, I have a set of types which are all arithmetic (have operators for addition, subtraction, multiplication, etc.). I want to aggregate any number of them into a single object, so I'm using the std::tuple class template and the <tuple> library (and Boost.Tuple for backward compatibility). My question is a bit of a shot in the dark: Has anyone heard or seen a tuple-like class template that implements all the arithmetic operators? For example, the std::tuple and boost::tuple classes both implement all the comparison operators which will only compile correctly if all the types contained in the tuple also have …

Member Avatar
Member Avatar
+0 forum 4

Anyone who knows how I can download boost library manual in zipped html chm or pdf? I'm not always working with internet and I will be working with some boost libs(latest). Thanks

Member Avatar
Member Avatar
+0 forum 3

Hi Daniweb, I've been programming a base class resource manager for a game I'm working on, and so read up on boost's shared_ptr and weak_ptr. I'm done with it and it works and I would really appreciate some feedback on my choice of implementation and design. Am I using the smart pointers in a correct way? Am I overcomplicating things? etc... Here's the code: [CODE] #ifndef RESOURCE_MANAGER_HPP #define RESOURCE_MANAGER_HPP #include <map> #include <string> #include <iostream> #include <stdexcept> #include <boost/smart_ptr/shared_ptr.hpp> #include <boost/smart_ptr/weak_ptr.hpp> template<typename T> class ResourceManager { // Type definitions protected: typedef boost::shared_ptr<T> Resource; // Not to be used by users …

Member Avatar
+0 forum 0

[CODE]Server::Server(boost::asio::io_service& io_service,std::string ip,short port,std::shared_ptr<ConnectionFactory> factory) : acceptor_(io_service, boost::asio::ip::tcp::endpoint(boost::asio::ip::address_v4::from_string(ip.data()), port)){ m_factory = factory; start_accept(); std::cout<<"Socket accepting connections..."<<std::endl; } Server::~Server() { } void Server::start_accept(){ boost::asio::io_service io_service; std::shared_ptr<Connection> conn = m_factory->create(io_service); acceptor_.async_accept(conn->socket(), boost::bind(&Server::handle_accept, this,conn, boost::asio::placeholders::error)); } void Server::handle_accept(std::shared_ptr<Connection> conn,const boost::system::error_code& error){ if (!error) { std::cout<<"on connected"<<std::endl; conn->OnConnected(); start_accept(); } } [/CODE] when i run the project i got [CODE] Unhandled exception at 0x00c55c8c in AccountServer.exe: 0xC0000005: Access violation reading location 0xfeeeff02.[/CODE] and the call stack here > [CODE]AccountServer.exe!boost::asio::detail::win_iocp_io_service::register_handle(void * handle, boost::system::error_code & ec) Line 135 + 0x9 bytes C++[/CODE] so what's wrong here?!!

Member Avatar
Member Avatar
+0 forum 1

[CODE]class Connection { public: typedef boost::shared_ptr<Connection> pointer; static pointer create(boost::asio::io_service& io_service){return pointer(new Connection(io_service));} explicit Connection(boost::asio::io_service& io_service); virtual ~Connection(); boost::asio::ip::tcp::socket& socket(); -->>>virtual void OnConnected()=0; void Send(uint8_t* buffer, int length); bool Receive(); private: void handler(const boost::system::error_code& error, std::size_t bytes_transferred ); boost::asio::ip::tcp::socket socket_; };[/CODE] when am trying to use virtual void OnConnected()=0; it gives me this stupid error idk whats wrong!!! [CODE] 1 IntelliSense: object of abstract class type "Connection" is not allowed: d:\c++\ugs\accountserver\connection.h 17[/CODE] whats wrong and how can i fix it while in my old connection class it was working good!! [CODE]class Connection { public: explicit Connection(int socket); virtual ~Connection(); virtual …

Member Avatar
Member Avatar
+0 forum 1

is there is a tutorial about how to use boost:asio how to send how to recive , coz all the tutorials i checked is only showin me an example of server source or a client source. so please if there is one link me to it thnx alot :)

Member Avatar
+0 forum 0

[code] std::tr1::array<double, 10> alpha; std::iota(alpha.begin(), alpha.end(), 0); using namespace boost::accumulators; size_t const SIZE = 1000000; accumulator_set<double, stats<tag::mean, tag::lazy_variance > > acc; std::for_each(alpha.begin(), alpha.end(), [&](double const VALUE){ acc(VALUE);}); [/code] How could I clear the contents of the acc if I want to evaluate a new mean and variance? Thank you very much.

Member Avatar
Member Avatar
+0 forum 11

I try to transmit an OpenCV IplImage from a Server (Ubuntu x64) to a Client (Win7 x64) The following code works fine if both (Client and Server) are on the same operating system. But when the server is on Ubuntu and the client on Win7 it doesn't work. The image header is correct, but something with the image data is wrong. I think this is because of the different bit-order between the two OS. How can I resolve this problem? And second: The transmission with this code is slow as hell :D . How can I improve the speed? Client: …

Member Avatar
Member Avatar
+0 forum 1

Is there a way to add months and their respective days in my + operator?[code]Date operator + (Date const& dt, Month const& m) { jdn_type months_to_add = m.month_; jdn_type days_to_add; gregorian_type g = dt.gregorian(); long d = std::get<1>(g); if(d == 1){ days_to_add = 31*m.month_; } else if(d == 2){ days_to_add = 28*m.month_; } else if(d == 3){ days_to_add = 31*m.month_; } else if(d == 4){ days_to_add = 30*m.month_; } else if(d == 5){ days_to_add = 31*m.month_; } else if(d == 6){ days_to_add = 30*m.month_; } else if(d == 7){ days_to_add = 31*m.month_; } else if(d == 8){ days_to_add = 31*m.month_; …

Member Avatar
+0 forum 0

Is it the boost library? Regex in particular? I have searched and searched, but this is all I could come up with. If this is the correct library, then how do I get it to work in Dev-C++? I managed to add all the boost .h files to my Dev-C++ include files folder, so now it will compile when I #include a boost header file. Does it even work in Dev-C++ though? I couldn't get it installed properly in Visual Studio. I think the path name was not quite right (to include the boost root directory). Also, how do you …

Member Avatar
Member Avatar
+0 forum 1

Hi guys, Im working on a small console app to seek out all those pesky and disk consuming .ncb files and debug folders left from VS and destroy them so the space i need to backup the files is considerably reduced. I have got my recusrion algorithm to scan as deep as it needs to (seems to be working fine) But the issue is when i want to delete the files. I have a function that worked fine when i passed a path refrence to it, but to get recusrion i changed over to directory iterators. Using these i now …

Member Avatar
Member Avatar
+0 forum 2

The End.