Hi,
Im using a map implementation that has structures as both the key and it value.
Ive used as below:
typedef struct RadioMeasurment Type
{
enum measurementId;
uint32 radioCardId;
uint32 radioPathId;
enum radioPathType;
}RadioMeasurmen tType;
typedef struct pmRegisterInfoT ype
{
uint32 pmHandle ;
uint32 tupleHandle;
uint32 registerId ;
}pmRegisterInfo Type;
RadioMeasurment Type RadioMeasurment ;
pmRegisterInfoT ype pmRegisterInfo;
typedef map<RadioMeasur mentType, pmRegisterInfoT ype>
radioMeasmntsRe gisterInfoMapTy pe;
radioMeasmntsRe gisterInfoMapTy pe radioPathMeasmn tsRegisterInfoM ap ;
=> then I updated the info inside the structures, as below:
bzero(&pmRegist erInfo, sizeof(pmRegist erInfoType));
pmRegisterInfo. pmHandle = pmHandle;
pmRegisterInfo. pmTupleHandle = m_radioTempInfo .tupleHandle;
pmRegisterInfo. registerId = m_radioTempInfo .radioBoardTemp RegId;
bzero(&radioPat hMeasmntsRegist erInfoMap , sizeof(radioMea smntsRegisterIn foMapType ));
RadioMeasurment .measurementId = TX_PATH_TEMP_SE NSOR;
RadioMeasurment .radioCardId = param.radio_car d_id;
RadioMeasurment .radioPathId = param.path_id;
=> I then performed the operation of updating my map (adding the value to a corresponding key) as below:
m_txPathMeasmnt sRegisterInfoMa p[txMeasurmentIdC ardIdPathIdInfo] = pmRegisterInfo;
=> i get compiler error
Can any one help me in adding the corresponding key and its value inside the map.I know its not correct using the structures as key and value in map, but it is my requirement.
1)How do I add elements in to the map?
2)how do I search these elements later using map.find(key); method??
Awaiting the reply
Regards
Srini
1 2611 sicarie 4,677
Recognized Expert Moderator Specialist
Hi,
Im using a map implementation that has structures as both the key and it value.
Ive used as below:
typedef struct RadioMeasurment Type
{
enum measurementId;
uint32 radioCardId;
uint32 radioPathId;
enum radioPathType;
}RadioMeasurmen tType;
typedef struct pmRegisterInfoT ype
{
uint32 pmHandle ;
uint32 tupleHandle;
uint32 registerId ;
}pmRegisterInfo Type;
RadioMeasurment Type RadioMeasurment ;
pmRegisterInfoT ype pmRegisterInfo;
typedef map<RadioMeasur mentType, pmRegisterInfoT ype>
radioMeasmntsRe gisterInfoMapTy pe;
radioMeasmntsRe gisterInfoMapTy pe radioPathMeasmn tsRegisterInfoM ap ;
=> then I updated the info inside the structures, as below:
bzero(&pmRegist erInfo, sizeof(pmRegist erInfoType));
pmRegisterInfo. pmHandle = pmHandle;
pmRegisterInfo. pmTupleHandle = m_radioTempInfo .tupleHandle;
pmRegisterInfo. registerId = m_radioTempInfo .radioBoardTemp RegId;
bzero(&radioPat hMeasmntsRegist erInfoMap , sizeof(radioMea smntsRegisterIn foMapType ));
RadioMeasurment .measurementId = TX_PATH_TEMP_SE NSOR;
RadioMeasurment .radioCardId = param.radio_car d_id;
RadioMeasurment .radioPathId = param.path_id;
=> I then performed the operation of updating my map (adding the value to a corresponding key) as below:
m_txPathMeasmnt sRegisterInfoMa p[txMeasurmentIdC ardIdPathIdInfo] = pmRegisterInfo;
=> i get compiler error
Can any one help me in adding the corresponding key and its value inside the map.I know its not correct using the structures as key and value in map, but it is my requirement.
1)How do I add elements in to the map?
2)how do I search these elements later using map.find(key); method??
Awaiting the reply
Regards
Srini
Can we see the compiler error?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Christopher |
last post by:
I am having problems iterating through the sequence of objects stored in my
std::map I want to call a function from the "value" object in the map. Here
is my snippet:
typedef std::map<SOCKET, Player> PLAYERMAP_SOCKET;
.....
BOOL Player::Send(std::string data)
......
// Send the text to all clients
|
by: Kin Pang |
last post by:
Hi,
I have a routine where I'm using a std::map from a pair of ints to double
for caching evaluation results.
The cache depth could be upto say 1000 in depth.
However, my application needs to clear and replenish the cache repeatedly
and profiling seems to suggests
the performance is handicated by repeated calls to new.
Can anybody advice me on how to improve the performance or suggests
alternatives please.
|
by: Christopher Benson-Manica |
last post by:
If you liked the functionality of std::map, but found that you
couldn't trust your implementation to handle nonstandard data
structures, how would you code a wrapper? I've produced the
following:
#include <map>
template < class keytype, class recordtype >
class pseudomap
{
|
by: EnTn |
last post by:
Hi Everyone...
I've been trying to use a std::map to do some storage. Basically, i'm
storing double values using a Key Object. The Key object is quite
simple and is just a pair of int's (conceptually these are 2d coords).
My problem is: I have setup a simple test probgram that populates a
map with 9 <key,value> pairs. When I try to query the map using
|
by: Flzw |
last post by:
Well I have a map like this :
std::map <string, CObject> ObjectList;
I have a function like this :
CObject* NewObject( char* Name, CArg* Arg)
{
std::string key = Name;
ObjectList = CObject( Name, Arg);
| |
by: Saeed Amrollahi |
last post by:
Dear All C++ Programmers
Hello
I am Saeed Amrollahi. I am a software engineer in
Tehran Sewerage Company. I try to use std::map and map::find member
function. I
use Visual Studio .NET. my program uses two MFC classes: CRect and
CPoint
which represents Rectangle and Point concepts (as usual) and a user
|
by: Gernot Frisch |
last post by:
restart:
for (std::map<x,y>::iterator it = m.begin(); it!=m.end(); ++it)
{
if( it->second.isbad() )
{
std::map<x,y>::iterator next = it;
++next;
m.erase(it);
it=next;
// goto restart;
|
by: Fei Liu |
last post by:
Hello, I am getting something really wierd out of this source code, can
you please verify if you also get segmentation fault (memory failure)?
http_form.h: (sorry about the line wrapping, email client problem)
#ifndef HTTP_FORM_H
#define HTTP_FORM_H
#include <map>
#include <string>
#include <iostream>
|
by: Matthias Pfeifer |
last post by:
Hi there,
a std::map is build from std::pair elements where for a pair p p.first
is called the key and p.second the value. Is there a way to keep the map
sorted by the values? Ie is there a std::key_compare in the stl that
offeres this functionality? It's ok if this would make finding a key
more expensive. Writing my own would be possible, but why do it if it's
already there...
matthias
|
by: Chris Forone |
last post by:
Hello group,
g++ (3.4.2, mingw):
float init = {1.f, 2.f, 3.f};
std::map<std::string, std::valarray<float mp;
mp = std::valarray(init, 3);
mp.size(); // should be 3, but IS 0!
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |