Bonjour à tous

Voici un résumé du code qui me pose un petit problème :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 
typedef map<char*, char*> M_OID;
typedef map<char*, M_OID> M_OIDS;
typedef map<char*, M_OIDS> M_PDUS;
typedef map<char*, M_PDUS> M_LOGONS;
typedef map<char*, M_LOGONS> M_STS;
 
M_OID mapOid;
M_OIDS mapOids;
M_PDUS mapPdus;
M_LOGONS mapLogons;
M_STS mapSts;
 
 
void fillMaps()
{
	mapOid["Name"] = ".1.2";	
	mapOids["OID12"] = mapOid;
	mapPdus["pdu1"] = mapOids;
	mapLogons["Normal"] = mapPdus;
	mapSts["ABC123"] = mapLogons;
}
 
 
void readMaps()
{
	M_OIDS::iterator itOid;
	M_PDUS::iterator itPdu;
	M_LOGONS::iterator itLogon;
	M_STS::iterator itSt;
 
	M_OID mapOidFound;
	M_OIDS mapOidsBrowsed;
	M_PDUS mapPdusFound;
	M_LOGONS mapLogonsFound;
 
	itSt = mapSts.find("ABC123");
	if ( itSt != mapSts.end() )
	{
		mapLogonsFound = itSt->second;
 
		itLogon = mapLogonsFound.find("Normal");
		if ( itLogon != mapLogonsFound.end() )
		{
			mapPdusFound = itLogon->second;
 
			// Dans mon code réel, je ne connais pas le nom de la PDU où se trouve l'OID recherché,
			// alors je vais toutes les parcourir
			for ( itPdu = mapPdusFound.begin(); itPdu != mapPdusFound.end(); itPdu++ ) 
			{
				mapOidsBrowsed = itPdu->second;
 
				itOid = mapOidsBrowsed.find("OID12");
				if ( itOid != mapOidsBrowsed.end() )
				{
					mapOidFound = itOid->second;
 
					printf("OID Found: %s", mapOidFound["Name"]); 
				}
			}
		}
	}
}
 
 
void main()
{
	fillMaps();
	readMaps();
}

  • En effet, j'ai une erreur sur chacune des lignes de type : <= Edit : Corrigé par Poukill
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    mapxFound = itX->second();
  • De plus, le find ne semble pas fonctionner... : lors du " if iterator != map.end() " il ne rentre jamais dans le then...



Où se trouve le problème d'après vous ? Car là j'avoue que je sèche complètement...

Merci d'avance pour votre aide !