File: Database.h

package info (click to toggle)
tango 9.3.4%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 95,792 kB
  • sloc: cpp: 138,382; sh: 8,009; ansic: 1,083; makefile: 996; java: 800; python: 264; xml: 54
file content (1914 lines) | stat: -rw-r--r-- 64,409 bytes parent folder | download | duplicates (2)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914

//+==================================================================================================================
//
// dbapi.h -	include file for TANGO database api
//
//
// Copyright (C) :      2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015
//						European Synchrotron Radiation Facility
//                      BP 220, Grenoble 38043
//                      FRANCE
//
// This file is part of Tango.
//
// Tango is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Tango is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License along with Tango.
// If not, see <http://www.gnu.org/licenses/>.
//
// $Revision$
//
//-================================================================================================================


#ifndef _DATABASE_H
#define _DATABASE_H

/****************************************************************************************
 * 																						*
 * 					The Database class													*
 * 					------------------													*
 * 																						*
 ***************************************************************************************/

/**
 * A high level object which contains the link to the database.
 *
 * This class has methods for all database commands e.g. get_device_property(),
 * device_list(), info(), etc.
 *
 * $Author: taurel $
 * $Revision: 1 $
 *
 * @headerfile tango.h
 * @ingroup DBase
 */

class Database : public Tango::Connection
{
private :
	virtual string get_corba_name(bool);
	virtual string build_corba_name() {return string("nada");}
	virtual int get_lock_ctr() {return 0;}
	virtual void set_lock_ctr(int) {}

    class DatabaseExt
    {
    public:
        DatabaseExt() {};

		string	orig_tango_host;
    };

#ifdef HAS_UNIQUE_PTR
    unique_ptr<DatabaseExt>     ext;
#else
	DatabaseExt			        *ext;
#endif

	bool				db_multi_svc;
	vector<string>		multi_db_port;
	vector<string>		multi_db_host;
	FileDatabase 		*filedb;
	string 				file_name;
	int					serv_version;

	AccessProxy			*access_proxy;
	bool				access_checked;
	DevErrorList		access_except_errors;

	map<string,string>	dev_class_cache;
	string				db_device_name;

	bool				access_service_defined;

    Tango::Util         *db_tg;
    omni_mutex          map_mutex;

	DbDatum         make_string_array(string, CORBA::Any_var &);
	vector<DbHistory> make_history_array(bool, CORBA::Any_var &);

	void check_access();
	inline string dev_name();
	void set_server_release();
	void check_access_and_get();

public :
/**@name Constructors */
//@{
/**
 * Create a TANGO Database object.
 *
 * The constructor uses the environment variable “TANGO_HOST” to
 * determine which instance of the TANGO database to connect to. Example :
 * @code
 * using namespace Tango;
 * Database *db = new Database();
 * @endcode
 *
 * @param [in] orb	The CORBA ORB pointer. Default value is fine for 99 % of cases
 *
 */
	Database(CORBA::ORB *orb=NULL);
// @}

/**@name General methods */
//@{
/**
 * Get database info.
 *
 * Query the database for some general info about the tables in the database.
 * Result is returned as a string. Example :
 * @code
 * cout << db->get_info() << endl;
 * @endcode
 * will return information like this:
 * @code
 * Running since 2000-11-06 14:10:46
 * Devices defined = 115
 * Devices exported = 41
 * Device servers defined = 47
 * Device servers exported = 17
 * Class properties defined = 5
 * Device properties defined = 130
 * Class attribute properties defined = 20
 * Device attribute properties defined = 92
 * @endcode
 *
 * @return The string giving database info
 *
 * @exception ConnectionFailed, CommunnicationFailed, DevFailed from device
 */
	string get_info();
//@}

/**@name Device oriented methods */
//@{
/**
 * Add a device into the database.
 *
 * Add a device to the database. The device name, server and class are specified in the DbDevInfo structure.
 * Example :
 * @code
 * DbDevInfo my_device_info;
 *
 * my_device_info.name = “my/own/device”;
 * my_device_info._class = “MyDevice”;
 * my_device_info.server = “MyServer/test”;
 *
 * db->add_device(my_device_info);
 * @endcode
 *
 * @param [in] dev_info A reference to a DbDevInfo instance with all device info.
 *
 * @exception ConnectionFailed, CommunnicationFailed, DevFailed
 */
	void add_device(DbDevInfo &dev_info);
/**
 * Delete a device from the database.
 *
 * Delete the device of the specified name from the database. Example
 * @code
 * db->delete_device(“my/own/device”);
 * @endcode
 *
 * @param [in] dev_name The device name
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device (DB_SQLError, DB_DeviceNotDefined)
 */
	void delete_device(string dev_name);
/**
 * Import a device from the database.
 *
 * Query the database for the export info of the specified device.
 * The command returns the information in a DbDevImportInfo structure. Example :
 * @code
 * DbDevImportInfo my_device_import;
 *
 * my_device_import = db->import_device(“my/own/device”);
 *
 * cout << “ device ” << my_device_import.name;
 * cout << “exported ” << my_device_import.exported;
 * cout << “ior ” << my_device_import.ior;
 * cout << “version ” << my_device_import.version;
 * cout << endl;
 * @endcode
 *
 * @param [in] dev_name The device name
 * @return One instance of a DbDevImportInfo class
 *
 * @exception ConnectionFailed, CommunicationFailed, DevFailed
 */
	DbDevImportInfo import_device(string &dev_name);
/**
 * Export a device into the database.
 *
 * Update the export info for this device in the database. Device name, server, class, pid and version are
 * specified in the DbDevExportInfo structure. Example :
 * @code
 * DbDevExportInfo my_device_export;
 *
 * my_device_export.name = “my/own/device”;
 * my_device_export.ior = “the real ior”;
 * my_device_export.host = “dumela”;
 * my_device_export.version = “1.0”;
 * my_device_export.pid = get_pid();
 *
 * db->export_device(my_device_export);
 * @endcode
 *
 * @param [in] info The device export information
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device (DB_SQLError, DB_DeviceNotDefined)
 */
	void export_device(DbDevExportInfo &info);
/**
 * Unexport a device in the database.
 *
 * Mark the specified device as un-exported in the database. Example :
 * @code
 * db->unexport_device(“my/own/device”);
 * @endcode
 *
 * @param [in] dev_name The device name
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device (DB_SQLError)
 */
	void unexport_device(string dev_name);
/**
 * Get device information
 *
 * Return miscellaneous device information from the database (not from the device itself)
 *
 * @param [in] dev_name The device name
 * @return The device information class instance
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDevFullInfo get_device_info(string &dev_name);
/**
 * Get class name for a device
 *
 * Return the class of the specified device.
 * @code
 * string devname("sr/rf-cavity/1");
 * string classname = db->get_class_for_device(devname);
 * @endcode
 *
 * @param [in] dev_name The device name
 * @return The device class name
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	string get_class_for_device(string &dev_name);
/**
 * Get device inheritance scheme
 *
 * Return the class inheritance scheme of the specified device
 * @code
 * string devname("sr/rf-cavity/1");
 *
 * DbDatum db_datum = db->get_class_inheritance_for_device(devname);
 *
 * vector<string> class_list;
 * db_datum >> class_list;
 * @endcode
 *
 * @param [in] dev_name The device name
 * @return The device inheritance
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_class_inheritance_for_device(string &dev_name);
//@}

/**@name Server oriented methods */
//@{
/**
 * Create a device server process in database.
 *
 * Add a group of devices to the database.
 * The device names, server names and classes are specified in a vector of DbDevInfo structures.
 *
 * @param [in] ds_name The full device server process name
 * @param [in] devs Vector of DbDevInfo instances
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device (DB_SQLError)
 */
	void add_server(string &ds_name, DbDevInfos &devs);
/**
 * Delete a device server process from the database.
 *
 * Delete the device server and its associated devices from the database.
 *
 * @param [in] ds_name The full device server process name
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device (DB_SQLError)
 */
	void delete_server(string &ds_name);
/**
 * Delete a device server process from the database.
 *
 * Export a group of devices to the database.
 * The device names, IOR, class, server name, pid etc. are specified in the vector of DbDevExportInfo structures.
 *
 * @param [in] devs Devices information in a vector of DbDevExportInfo
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device (DB_SQLError)
 */
	void export_server(DbDevExportInfos &devs);
/**
 * Unexport all devices from a device server in the database.
 *
 * Mark all devices exported for this device server process as unexported.
 *
 * @param [in] ds_name The full device server process name
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device (DB_SQLError)
 */
	void unexport_server(string &ds_name);
/**
 * Rename a device server in the database.
 *
 * Rename a device server process in the database.
 *
 * @param [in] old_ds_name The old device server process name
 * @param [in] new_ds_name The new device server process name
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device (DB_SQLError)
 */
	void rename_server(const string &old_ds_name,const string &new_ds_name);
//@}

/**@name Services oriented methods */
//@{
/**
 * Get services list from database
 *
 * Query database for specified services. The instname parameter can be a wildcard character ("*").
 * @code
 * string servicename("HdbManager");
 * string instname("ctrm");
 *
 * DbDatum db_datum = db->get_services(servicename,instname);
 *
 * vector<string> service_list;
 * db_datum >> service_list;
 * @endcode
 *
 * @param [in] service_name The service name
 * @param [in] inst_name The instance name
 * @return A service list matching the input parameters
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_services(string &service_name,string &inst_name);
/**
 * Get services list from database
 *
 * Query database for specified services. The vector of strings returned in the DbDatum
 * object contains pair of strings &lt;instance_name&gt; followed by &lt;device name&gt;.
 * @code
 * string servicename("HdbManager");
 *
 * DbDatum db_datum = db->get_device_service_list(servicename);
 *
 * vector<string> service_device_list;
 * db_datum >> service_device_list;
 * @endcode
 *
 * @param [in] service_name The service name
 * @return A service/device list matching the input parameter
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_device_service_list(string &service_name);
/**
 * Register a service in the database
 *
 * Register the specified service wihtin the database.
 * @code
 * string servicename("HdbManager");
 * string instname("ctrm");
 * string devname("sys/hdb/1");
 *
 * db->register_service(servicename,instname,devname);
 * @endcode
 *
 * @param [in] service_name The service name
 * @param [in] inst_name The instance name
 * @param [in] dev_name The device name implementing the service
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void register_service(string &service_name,string &inst_name,string &dev_name);
/**
 * Unregister a service from the database
 *
 * Unregister the specified service from the database.
 * @code
 * string servicename("HdbManager");
 * string instname("ctrm");
 *
 * db->unregister_service(servicename,instname);
 * @endcode
 *
 * @param [in] service_name The service name
 * @param [in] inst_name The instance name
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void unregister_service(string &service_name,string &inst_name);
//@}

/**@name Object property oriented methods */
//@{
/**
 * Get object property value
 *
 * Query the database for a list of object (i.e. non-device) properties for the specified object. The property
 * names are specified by the vector of DbDatum structures. The method returns the properties in the same
 * DbDatum structures. To retrieve the properties use the extract operator >>. Here is an example of how to
 * use the DbData type to specify and extract properties :
 * @code
 * DbData db_data;
 * db_data.push_back(DbDatum(“velocity”));
 * db_data.push_back(DbDatum(“acceleration”));
 *
 * db->get_property(“mymotor”, db_data);
 *
 * float velocity, acceleration;
 * db_data[0] >> velocity;
 * db_data[1] >> acceleration;
 * @endcode
 *
 * @param [in] obj_name The object (free property) name
 * @param [in,out] db The property names and values
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void get_property(string obj_name, DbData &db) {get_property(obj_name,db,NULL);}
/**
 * Put object property value in database
 *
 * Insert or update a list of properties for the specified object. The property names and their values are
 * specified by the vector of DbDatum structures. Use the insert operator >> to insert the properties into the
 * DbDatum structures. Here is an example of how to insert properties into the database using this method :
 * @code
 * DbDatum velocity(“velocity”), acceleration(“acceleration”);
 * DbData db_data;
 *
 * velocity << 100000.0;
 * acceleration << 500000.0;
 * db_data.push_back(velocity);
 * db_data.push_back(acceleration);
 *
 * db->put_property(“mymotor”, db_data);
 * @endcode
 *
 * @param [in] obj_name The object (free property) name
 * @param [in] db The property names and values
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void put_property(string obj_name, DbData &db);
/**
 * Delete object property from database
 *
 * Delete a list of properties for the specified object. The property names are specified by the vector of
 * DbDatum structures. Here is an example of how to delete properties from the database using this method :
 * @code
 * DbData db_data;
 * db_data.push_back(DbDatum(“velocity”));
 * db_data.push_back(DbDatum(“acceleration”));
 *
 * db->delete_property(“mymotor”, db_data);
 * @endcode
 *
 * @param [in] obj_name The object (free property) name
 * @param [in] db The property names
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void delete_property(string obj_name, DbData &db);
/**
 * Get object property history from database
 *
 * Get the list of the last 10 modifications of the specifed object property. Note that propname can contain a
 * wildcard character (eg: "prop*").
 * @code
 * vector<DbHistory> hist;
 * DbDatum result;
 * string objname("jlptest");
 * string propname("test_prop");
 *
 * hist = db->get_property_history(objname,propname);
 *
 * // Print the modification history of the specified property
 * for(int i=0;i<hist.size();i++)
 * {
 *    cout << "Name:" << hist[i].get_name() << endl;
 *    cout << "Date:" << hist[i].get_date() << endl;
 *    if( hist[i].is_deleted() )
 *    {
 *        cout << "Deleted !" << endl;
 *    }
 *    else
 *    {
 *        hist[i].get_value() >> result;
 *        for (int j=0; j<result.size(); j++)
 *           cout << "Value:" << result[j] << endl;
 *    }
 * }
 * @endcode
 *
 * @param [in] obj_name The object (free property) name
 * @param [in] prop_name The property name
 * @return A vector of DbHistory instances
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	vector<DbHistory> get_property_history(string &obj_name,string &prop_name);
//@}

/**@name Device property oriented methods */
//@{
/**
 * Get device property value
 *
 * Query the database for a list of device properties for the specified object. The property names are specified
 * by the vector of DbDatum structures. The method returns the properties in the same DbDatum structures.
 * To retrieve the properties use the extract operator >>. Here is an example of how to use the DbData type to
 * specify and extract properties :
 * @code
 * DbData db_data;
 * db_data.push_back(DbDatum(“velocity”));
 * db_data.push_back(DbDatum(“acceleration”));
 *
 * db->get_device_property(“id11/motor/1”, db_data);
 *
 * float velocity, acceleration;
 * db_data[0] >> velocity;
 * db_data[1] >> acceleration;
 * @endcode
 *
 * @param [in] dev_name The device name
 * @param [in,out] db The property names and values
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void get_device_property(string dev_name, DbData &db) {get_device_property(dev_name,db,NULL);}
/**
 * Put device property value in database
 *
 * Insert or update a list of properties for the specified device. The property names and their values are
 * specified by the vector of DbDatum structures. Use the insert operator >> to insert the properties into the
 * DbDatum structures. Here is an example of how to insert properties into the database using this method :
 * @code
 * DbDatum velocity(“velocity”), acceleration(“acceleration”);
 * DbData db_data;
 *
 * velocity << 100000.0;
 * acceleration << 500000.0;
 * db_data.push_back(velocity);
 * db_data.push_back(acceleration);
 *
 * db->put_device_property(“id11/motor/1”, db_data);
 * @endcode
 *
 * @param [in] dev_name The device name
 * @param [in] db The property names and values
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void put_device_property(string dev_name, DbData &db);
/**
 * Delete device property from database
 *
 * Delete a list of properties for the specified device. The property names are specified by the vector of
 * DbDatum structures. Here is an example of how to delete properties from the database using this method :
 * @code
 * DbData db_data;
 * db_data.push_back(DbDatum(“velocity”));
 * db_data.push_back(DbDatum(“acceleration”));
 *
 * db->delete_device_property(“id11/motor/1”, db_data);
 * @endcode
 *
 * @param [in] dev_name The device name
 * @param [in] db The property names
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void delete_device_property(string dev_name, DbData &db);
/**
 * Get device property history from database
 *
 * Get the list of the last 10 modifications of the specifed device property. Note that prop_name can contain
 * a wildcard character (eg: "prop*"). An example of usage of a similar function can be found in the
 * documentation of the get_property_history() function.
 *
 * @param [in] dev_name The device name
 * @param [in] prop_name The property name
 * @return A vector of DbHistory instances
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	vector<DbHistory> get_device_property_history(string &dev_name,string &prop_name);
//@}

/**@name Device attribute property oriented methods */
//@{
/**
 * Get device attribute property value
 *
 * Query the database for a list of device attribute properties for the specified object. The attribute names
 * are specified by the vector of DbDatum structures. The method returns all the properties for the specified
 * attributes. The attribute names are returned with the number of properties specified as their value. The
 * first DbDatum element of the returned DbData vector contains the first attribute name and the first attribute
 * property number. The following DbDatum element contains the first attribute property name and property
 * values. To retrieve the properties use the extract operator >>. Here is an example of how to use the DbData
 * type to specify and extract attribute properties :
 * @code
 * DbData db_data;
 *
 * db_data.push_back(DbDatum("velocity"));
 * db_data.push_back(DbDatum("acceleration"));
 *
 * db->get_device_attribute_property("id11/motor/1", db_data);
 *
 * float vel_max, vel_min, acc_max, acc_min;
 * for (int i=0;i < db_data.size();i++)
 * {
 *    long nb_prop;
 *    string &att_name = db_data[i].name;
 *    db_data[i] >> nb_prop;
 *    i++;
 *    for (int k=0;k < nb_prop;k++)
 *    {
 *        string &prop_name = db_data[i].name;
 *        if (att_name == "velocity")
 *        {
 *           if (prop_name == "min")
 *              db_data[i] >> vel_min;
 *           else if (att_name == "max")
 *              db_data[i] >> vel_max;
 *        }
 *        else
 *        {
 *           if (prop_name == "min")
 *              db_data[i] >> acc_min;
 *           else
 *              db_data[i] >> acc_max;
 *        }
 *        i++;
 *     }
 * }
 * @endcode
 *
 * @param [in] dev_name The device name
 * @param [in,out] db The property names and values
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void get_device_attribute_property(string dev_name, DbData &db) {get_device_attribute_property(dev_name,db,NULL);}
/**
 * Put device attribute property value in database
 *
 * Insert or update a list of attribute properties for the specified device. The attribute property names and their
 * values are specified by the vector of DbDatum structures. Use the insert operator >> to insert the properties
 * into the DbDatum structures. Here is an example of how to insert/update properties min, max for attribute
 * velocity and properties min, max for attribute acceleration of device id11/motor/1 into the database using
 * this method :
 * @code
 * DbDatum vel("velocity");                // We want to put properties for attribute "velocity"
 * DbDatum vel_min("min"), vel_max("max");
 * DbDatum acc("acceleration")             // We want to put properties for attribute "acceleration"
 * DbDatum acc_min("min"), acc_max("max");
 * DbData db_data;
 *
 * vel << 2;                               // Two properties for attribute "velocity"
 * vel_min << 0.0;                         // Value for property min
 * vel_max << 1000000.0;                   // Value for property max
 *
 * db_data.push_back(vel);
 * db_data.push_back(vel_min);
 * db_data.push_back(vel_max);
 *
 * acc << 2;                               // Two properties for attribute "acceleration"
 * acc_min << 0.0;                         // Value for property min
 * acc_max << 8000000;                     // Value for property max
 *
 * db_data.push_back(acc);
 * db_data.push_back(acc_min);
 * db_data.push_back(acc_max);
 *
 * db->put_device_attribute_property(“id11/motor/1”, db_data);
 * @endcode
 *
 * @param [in] dev_name The device name
 * @param [in] db The property names and values
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void put_device_attribute_property(string dev_name, DbData &db);
/**
 * Delete device attribute property from database
 *
 * Delete a list of attribute properties for the specified device. The attribute names are specified by the vector
 * of DbDatum structures. Here is an example of how to delete the unit property of the velocity attribute of
 * the id11/motor/1 device using this method :
 * @code
 * DbData db_data;
 * db_data.push_back(DbDatum("velocity"));
 * db_data.push_back(DbDatum("unit"));
 *
 * db->delete_device_attribute_property("id11/motor/1", db_data);
 * @endcode
 *
 * @param [in] dev_name The device name
 * @param [in] db The property names
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void delete_device_attribute_property(string dev_name, DbData &db);
/**
 * Get device attribute property history from database
 *
 * Get the list of the last 10 modifications of the specifed device attribute property. Note that prop_name
 * and att_name can contain
 * a wildcard character (eg: "prop*"). An example of usage of a similar function can be found in the
 * documentation of the get_property_history() function.
 *
 * @param [in] dev_name The device name
 * @param [in] prop_name The property name
 * @param [in] att_name The property name
 * @return A vector of DbHistory instances
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	vector<DbHistory> get_device_attribute_property_history(string &dev_name,string &prop_name,string &att_name);
/**
 * Get list of attribute with data in database for a specific device
 *
 * Get the list of attribute(s) with some data defined in database for a specified device.
 * Note that this is not the list of all device attributes because not all attribute(s) have
 * some data in database
 *
 * @param [in] dev_name The device name
 * @param [in] att_list The attribute name list
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void get_device_attribute_list(string &dev_name,vector<string> &att_list);
/**
 * Get list of pipe with data in database for a specific device
 *
 * Get the list of pipe(s) with some data defined in database for a specified device.
 * Note that this is not the list of all device pipes because not all pipe(s) have
 * some data in database
 *
 * @param [in] dev_name The device name
 * @param [in] pipe_list The pipe name list
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void get_device_pipe_list(const string &dev_name,vector<string> &pipe_list);
//@}

/**@name Device pipe property oriented methods */
//@{
/**
 * Get device pipe property value
 *
 * Query the database for a list of device pipe properties for the specified object. The pipe names
 * are specified by the vector of DbDatum structures. The method returns all the properties for the specified
 * pipes. The pipe names are returned with the number of properties specified as their value. The
 * first DbDatum element of the returned DbData vector contains the first pipe name and the first pipe
 * property number. The following DbDatum element contains the first pipe property name and property
 * values. To retrieve the properties use the extract operator >>. Here is an example of how to use the DbData
 * type to specify and extract pipe properties :
 * @code
 * DbData db_data;
 *
 * db_data.push_back(DbDatum("velocity"));
 * db_data.push_back(DbDatum("acceleration"));
 *
 * db->get_device_pipe_property("id11/motor/1", db_data);
 *
 * float vel_max, vel_min, acc_max, acc_min;
 * for (int i=0;i < db_data.size();i++)
 * {
 *    long nb_prop;
 *    string &pipe_name = db_data[i].name;
 *    db_data[i] >> nb_prop;
 *    i++;
 *    for (int k=0;k < nb_prop;k++)
 *    {
 *        string &prop_name = db_data[i].name;
 *        if (pipe_name == "velocity")
 *        {
 *           if (prop_name == "min")
 *              db_data[i] >> vel_min;
 *           else if (att_name == "max")
 *              db_data[i] >> vel_max;
 *        }
 *        else
 *        {
 *           if (prop_name == "min")
 *              db_data[i] >> acc_min;
 *           else
 *              db_data[i] >> acc_max;
 *        }
 *        i++;
 *     }
 * }
 * @endcode
 *
 * @param [in] dev_name The device name
 * @param [in,out] db The pipe/property names and values
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void get_device_pipe_property(string dev_name, DbData &db) {get_device_pipe_property(dev_name,db,NULL);}
/**
 * Put device pipe property value in database
 *
 * Insert or update a list of pipe properties for the specified device. The pipe property names and their
 * values are specified by the vector of DbDatum structures. Use the insert operator >> to insert the properties
 * into the DbDatum structures. Here is an example of how to insert/update properties min, max for pipe
 * velocity and properties min, max for pipe acceleration of device id11/motor/1 into the database using
 * this method :
 * @code
 * DbDatum vel("velocity");                // We want to put properties for pipe "velocity"
 * DbDatum vel_min("min"), vel_max("max");
 * DbDatum acc("acceleration")             // We want to put properties for pipe "acceleration"
 * DbDatum acc_min("min"), acc_max("max");
 * DbData db_data;
 *
 * vel << 2;                               // Two properties for pipe "velocity"
 * vel_min << 0.0;                         // Value for property min
 * vel_max << 1000000.0;                   // Value for property max
 *
 * db_data.push_back(vel);
 * db_data.push_back(vel_min);
 * db_data.push_back(vel_max);
 *
 * acc << 2;                               // Two properties for pipe "acceleration"
 * acc_min << 0.0;                         // Value for property min
 * acc_max << 8000000;                     // Value for property max
 *
 * db_data.push_back(acc);
 * db_data.push_back(acc_min);
 * db_data.push_back(acc_max);
 *
 * db->put_device_pipe_property(“id11/motor/1”, db_data);
 * @endcode
 *
 * @param [in] dev_name The device name
 * @param [in] db The pipe/property names and values
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void put_device_pipe_property(string dev_name, DbData &db);
/**
 * Delete device pipe property from database
 *
 * Delete a list of pipe properties for the specified device. The pipe names are specified by the vector
 * of DbDatum structures. Here is an example of how to delete the unit property of the velocity pipe of
 * the id11/motor/1 device using this method :
 * @code
 * DbData db_data;
 * db_data.push_back(DbDatum("velocity"));
 * db_data.push_back(DbDatum("unit"));
 *
 * db->delete_device_attribute_property("id11/motor/1", db_data);
 * @endcode
 *
 * @param [in] dev_name The device name
 * @param [in] db The pipe/property names
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void delete_device_pipe_property(string dev_name, DbData &db);
/**
 * Get device pipe property history from database
 *
 * Get the list of the last 10 modifications of the specifed device pipe property. Note that prop_name
 * and pipe_name can contain
 * a wildcard character (eg: "prop*"). An example of usage of a similar function can be found in the
 * documentation of the get_property_history() function.
 *
 * @param [in] dev_name The device name
 * @param [in] pipe_name The property name
 * @param [in] prop_name The pipe name
 * @return A vector of DbHistory instances
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	vector<DbHistory> get_device_pipe_property_history(string &dev_name,string &pipe_name,string &prop_name);
//@}

/**@name Class property oriented methods */
//@{
/**
 * Get class property value
 *
 * Query the database for a list of class properties. The property names are specified by the vector of DbDatum
 * structures. The method returns the properties in the same DbDatum structures. To retrieve the properties
 * use the extract operator >>. Here is an example of how to use the DbData type to specify and extract
 * properties :
 * @code
 * DbData db_data;
 * db_data.push_back(DbDatum("velocity"));
 * db_data.push_back(DbDatum("acceleration"));
 *
 * db->get_class_property("StepperMotor", db_data);
 *
 * float velocity, acceleration;
 * db_data[0] >> velocity;
 * db_data[1] >> acceleration;
 * @endcode
 *
 * @param [in] class_name The class name
 * @param [in,out] db The property names and values
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void get_class_property(string class_name,DbData &db) {get_class_property(class_name,db,NULL);}
/**
 * Put class property value in database
 *
 * Insert or update a list of properties for the specified class. The property names and their values are specified
 * by the vector of DbDatum structures. Use the insert operator >> to insert the properties into the DbDatum
 * structures. Here is an example of how to insert properties into the database using this method :
 * @code
 * DbDatum velocity("velocity"), acceleration("acceleration");
 * DbData db_data;
 *
 * velocity << 100000.0;
 * acceleration << 500000.0;
 * db_data.push_back(velocity);
 * db_data.push_back(acceleration);
 *
 * db->put_class_property("StepperMotor", db_data);
 * @endcode
 *
 * @param [in] class_name The class name
 * @param [in] db The property names and values
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void put_class_property(string class_name, DbData &db);
/**
 * Delete class property from database
 *
 * Delete a list of properties for the specified class. The property names are specified by the vector of Db-
 * Datum structures. Here is an example of how to delete properties from the database using this method
 * @code
 * DbData db_data;
 * db_data.push_back(DbDatum("velocity"));
 * db_data.push_back(DbDatum("acceleration"));
 *
 * db->delete_class_property("StepperMotor", db_data);
 * @endcode
 *
 * @param [in] class_name The class name
 * @param [in] db The property names
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void delete_class_property(string class_name, DbData &db);
/**
 * Get class property history from database
 *
 * Get the list of the last 10 modifications of the specifed class property. Note that prop_name
 * can contain
 * a wildcard character (eg: "prop*"). An example of usage of a similar function can be found in the
 * documentation of the get_property_history() function.
 *
 * @param [in] class_name The class name
 * @param [in] prop_name The property name
 * @return A vector of DbHistory instances
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	vector<DbHistory> get_class_property_history(string &class_name,string &prop_name);
//@}

/**@name Class attribute property oriented methods */
//@{
/**
 * Get class attribute property value
 *
 * Query the database for a list of class attribute properties for the specified object. The attribute names are
 * specified by the vector of DbDatum structures. The method returns all the properties for the specified
 * attributes. The attribute names are returned with the number of properties specified as their value. The
 * first DbDatum element of the returned DbData vector contains the first attribute name and the first attribute
 * property number. The following DbDatum element contains the first attribute property name and property
 * values. To retrieve the properties use the extract operator >>. Here is an example of how to use the DbData
 * type to specify and extract attribute properties :
 * @code
 * DbData db_data;
 * db_data.push_back(DbDatum("velocity"));
 * db_data.push_back(DbDatum("acceleration"));
 *
 * db->get_class_attribute_property("StepperMotor", db_data);
 *
 * float vel_max, vel_min, acc_max, acc_min;
 * for (int i=0; i< db_data.size(); i++)
 * {
 *    long nb_prop;
 *    string &att_name = db_data[i].name;
 *    db_data[i] >> nb_prop;
 *    i++;
 *    for (int k=0;k < nb_prop;k++)
 *    {
 *        string &prop_name = db_data[i].name;
 *        if (att_name == "velocity")
 *        {
 *           if (prop_name == "min")
 *              db_data[i] >> vel_min;
 *           else if (att_name == "max")
 *              db_data[i] >> vel_max;
 *        }
 *        else
 *        {
 *           if (prop_name == "min")
 *              db_data[i] >> acc_min;
 *           else
 *              db_data[i] >> acc_max;
 *        }
 *        i++;
 *    }
 * }
 * @endcode
 *
 * @param [in] class_name The class name
 * @param [in,out] db The property names and values
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void get_class_attribute_property(string class_name,DbData &db) {get_class_attribute_property(class_name,db,NULL);}
/**
 * Put class attribute property value in database
 *
 * Insert or update a list of attribute properties for the specified class. The attribute property names and their
 * values are specified by the vector of DbDatum structures. Use the insert operator >> to insert the properties
 * into the DbDatum structures. Here is an example of how to insert/update min, max properties for attribute
 * velocity and min, max properties for attribute acceleration properties belonging to class StepperMotor into
 * the database using this method :
 * @code
 * DbDatum velocity("velocity"), vel_min("min"), vel_max("max");
 * DbDatum acceleration("acceleration"), acc_min("min"), acc_max("max");
 * DbData db_data;
 *
 * velocity << 2;
 * vel_min << 0.0;
 * vel_max << 1000000.0;
 *
 * db_data.push_back(velocity);
 * db_data.push_back(vel_min);
 * db_data.push_back(vel_max);
 *
 * acceleration << 2;
 * acc_min << 0.0;
 * acc_max << 8000000;
 *
 * db_data.push_back(acceleration);
 * db_data.push_back(acc_min);
 * db_data.push_back(acc_max);
 *
 * db->put_class_attribute_property("StepperMotor", db_data);
 * @endcode
 *
 * @param [in] class_name The class name
 * @param [in] db The property names and values
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void put_class_attribute_property(string class_name, DbData &db);
/**
 * Delete class attribute property from database
 *
 * Delete a list of attribute properties for the specified class. The attribute names are specified by the vector
 * of DbDatum structures. All properties belonging to the listed attributes are deleted. Here is an example of
 * how to delete the unit property of the velocity attribute of the StepperMotor class from the database using
 * this method :
 * @code
 * DbData db_data;
 * db_data.push_back(DbDatum("velocity"));
 * db_data.push_back(DbDatum("unit"));
 *
 * db->delete_class_attribute_property("StepperMotor", db_data);
 * @endcode
 *
 * @param [in] class_name The class name
 * @param [in] db The property names
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void delete_class_attribute_property(string class_name, DbData &db);
/**
 * Get class attribute property history from database
 *
 * Get the list of the last 10 modifications of the specifed class attribute property. Note that prop_name
 * and att_name can contain
 * a wildcard character (eg: "prop*"). An example of usage of a similar function can be found in the
 * documentation of the get_property_history() function.
 *
 * @param [in] class_name The class name
 * @param [in] att_name The attribute name
 * @param [in] prop_name The property name
 * @return A vector of DbHistory instances
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	vector<DbHistory> get_class_attribute_property_history(string &class_name,string &att_name,string &prop_name);
//@}

/**@name Class pipe property oriented methods */
//@{
/**
 * Get class pipe property value
 *
 * Query the database for a list of class pipe properties for the specified object. The pipe names are
 * specified by the vector of DbDatum structures. The method returns all the properties for the specified
 * pipes. The pipe names are returned with the number of properties specified as their value. The
 * first DbDatum element of the returned DbData vector contains the first pipe name and the first pipe
 * property number. The following DbDatum element contains the first pipe property name and property
 * values. To retrieve the properties use the extract operator >>. Here is an example of how to use the DbData
 * type to specify and extract pipe properties :
 * @code
 * DbData db_data;
 * db_data.push_back(DbDatum("pipe_image"));
 * db_data.push_back(DbDatum("pipe_misc"));
 *
 * db->get_class_pipe_property("MyDetector", db_data);
 *
 * int max_x, min_x, size;
 * for (int i=0; i< db_data.size(); i++)
 * {
 *    long nb_prop;
 *    string &pipe_name = db_data[i].name;
 *    db_data[i] >> nb_prop;
 *    i++;
 *    for (int k=0;k < nb_prop;k++)
 *    {
 *        string &prop_name = db_data[i].name;
 *        if (pipe_name == "pipe_image")
 *        {
 *           if (prop_name == "min_x")
 *              db_data[i] >> min_x;
 *           else if (att_name == "max_x")
 *              db_data[i] >> max_x;
 *        }
 *        else
 *        {
 *           if (prop_name == "size")
 *              db_data[i] >> size;
 *        }
 *        i++;
 *    }
 * }
 * @endcode
 *
 * @param [in] class_name The class name
 * @param [in,out] db The pipe/property names and values
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void get_class_pipe_property(string class_name,DbData &db) {get_class_pipe_property(class_name,db,NULL);}
/**
 * Put class pipe property value in database
 *
 * Insert or update a list of pipe properties for the specified class. The pipe property names and their
 * values are specified by the vector of DbDatum structures. Use the insert operator >> to insert the properties
 * into the DbDatum structures. Here is an example of how to insert/update min, max properties for pipe
 * velocity and min, max properties for pipe acceleration properties belonging to class StepperMotor into
 * the database using this method :
 * @code
 * DbDatum velocity("velocity"), vel_min("min"), vel_max("max");
 * DbDatum acceleration("acceleration"), acc_min("min"), acc_max("max");
 * DbData db_data;
 *
 * velocity << 2;
 * vel_min << 0.0;
 * vel_max << 1000000.0;
 *
 * db_data.push_back(velocity);
 * db_data.push_back(vel_min);
 * db_data.push_back(vel_max);
 *
 * acceleration << 2;
 * acc_min << 0.0;
 * acc_max << 8000000;
 *
 * db_data.push_back(acceleration);
 * db_data.push_back(acc_min);
 * db_data.push_back(acc_max);
 *
 * db->put_class_pipe_property("StepperMotor", db_data);
 * @endcode
 *
 * @param [in] class_name The class name
 * @param [in] db The pipe/property names and values
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void put_class_pipe_property(string class_name, DbData &db);
/**
 * Delete class pipe property from database
 *
 * Delete a list of pipe properties for the specified class. The pipe names are specified by the vector
 * of DbDatum structures. All properties belonging to the listed pipes are deleted. Here is an example of
 * how to delete the unit property of the velocity pipe of the StepperMotor class from the database using
 * this method :
 * @code
 * DbData db_data;
 * db_data.push_back(DbDatum("velocity"));
 * db_data.push_back(DbDatum("unit"));
 *
 * db->delete_class_pipe_property("StepperMotor", db_data);
 * @endcode
 *
 * @param [in] class_name The class name
 * @param [in] db The pipe/property names
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void delete_class_pipe_property(string class_name, DbData &db);
/**
 * Get class pipe property history from database
 *
 * Get the list of the last 10 modifications of the specifed class pipe property. Note that prop_name
 * and pipe_name can contain
 * a wildcard character (eg: "prop*"). An example of usage of a similar function can be found in the
 * documentation of the get_property_history() function.
 *
 * @param [in] class_name The class name
 * @param [in] pipe_name The pipe name
 * @param [in] prop_name The property name
 * @return A vector of DbHistory instances
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	vector<DbHistory> get_class_pipe_property_history(string &class_name,string &pipe_name,string &prop_name);
//@}

/**@name Alias oriented methods */
//@{
/**
 * Get device name from its alias
 *
 * Get the device name from its alias. The device alias is specified by alias and the device name
 * is returned in dev_name. If there is no device defined with the given alias, a DevFailed exception is thrown.
 *
 * @param [in] alias The device alias
 * @param [out] dev_name The device name
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void get_device_from_alias(string alias,string &dev_name);
/**
 * Get device alias form its name
 *
 * Get the device alias from its name. The device name is specified by dev_name and the device alias is
 * returned in alias. If there is no alias defined for the device, a DevFailed exception is thrown.
 *
 * @param [in] dev_name The device name
 * @param [out] alias The device alias
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void get_alias_from_device(string dev_name,string &alias);
/**
 * Get device alias from its name
 *
 * @deprecated use get_alias_from_device()
 *
 * Get the device alias name from its name. The device name is specified by dev_name and the device alias
 * name is returned in dev_alias. If there is no alias defined for the device, a DevFailed exception is thrown.
 *
 * @param [in] dev_name The device name
 * @param [out] dev_alias The device alias
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void get_alias(string dev_name,string &dev_alias);
/**
 * Get device name from its alias
 *
 * @deprecated use get_device_from_alias()
 *
 * Get the device name from an alias. The device alias is specified by dev_alias and the device name is
 * returned in dev_name. If there is no device with the given alias, a DevFailed exception is thrown.
 *
 * @param [in] dev_alias The device alias
 * @param [out] dev_name The device name
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void get_device_alias(string dev_alias,string &dev_name);
/**
 * Define device alias
 *
 * Create a device alias. Alias name has to be uniq within a Tango control system and you will receive an
 * exception if the alias is already defined.
 *
 * @param [in] dev_name The device name
 * @param [in] dev_alias The device alias
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void put_device_alias(string &dev_name,string &dev_alias);
/**
 * Delete device alias
 *
 * Delete a device alias.
 *
 * @param [in] dev_alias The device alias
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void delete_device_alias(string &dev_alias);
/**
 * Get attribute name from its alias
 *
 * Get the attribute name from its alias. The attribute alias is specified by alias and the attribute name
 * is returned in att_name. If there is no attribute defined with the given alias, a DevFailed exception is thrown.
 *
 * @param [in] alias The attribute alias
 * @param [out] att_name The attribute name
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void get_attribute_from_alias(string alias,string &att_name);
/**
 * Get attribute alias form its name
 *
 * Get the attribute alias from its name. The attribute name is specified by att_name and the attribute alias is
 * returned in alias. If there is no alias defined for the attribute, a DevFailed exception is thrown.
 *
 * @param [in] att_name The attribute name
 * @param [out] alias The attribute alias
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void get_alias_from_attribute(string att_name,string &alias);
/**
 * Get attribute name from its alias
 *
 * Get the full attribute name from an alias. The attribute alias is specified by att_alias and the full attribute
 * name is returned in att_name. If there is no attribute with the given alias, a DevFailed exception is thrown.
 *
 * @param [in] att_alias The attribute alias
 * @param [out] att_name The attribute name
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void get_attribute_alias(string att_alias, string &att_name);
/**
 * Define attribute alias
 *
 * Set an alias for an attribute name. The attribute alias is specified by att_alias and the attribute name is
 * specifed by att_name. If the given alias already exists, a DevFailed exception is thrown.
 *
 * @param [in] att_name The attribute name
 * @param [in] att_alias The attribute alias
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void put_attribute_alias(string &att_name,string &att_alias);
/**
 * Delete attribute alias
 *
 * Remove the alias associated to an attribute name.
 *
 * @param [in] att_alias The attribute alias
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	void delete_attribute_alias(string &att_alias);
//@}

/**@name Database browsing oriented methods */
//@{
/**
 * Get host list
 *
 * Returns the list of all host names registered in the database.
 * @code
 * DbDatum db_datum = db->get_host_list();
 *
 * vector<string> host_list;
 * db_datum >> host_list;
 * @endcode
 *
 * @return A host name list
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_host_list();
/**
 * Get host list with name matching a wildcard
 *
 * Returns the list of all host names registered in the database which match the specified wildcard (eg: "lc0*")
 * @code
 * string wildcard("l-c0*");
 *
 * DbDatum db_datum = db->get_host_list(wildcard);
 *
 * vector<string> host_list;
 * db_datum >> host_list;
 * @endcode
 *
 * @param [in] wildcard The wildcard
 * @return A host name list matching the input
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_host_list(string &wildcard);
/**
 * Get list of Tango classes embedded in a device server proess
 *
 * Query the database for a list of classes instancied by the specified server.
 * The DServer class exists in all TANGO servers and for this reason this class
 * is removed from the returned list.
 * @code
 * string server("Serial/1");
 *
 * DbDatum db_datum = db->get_server_class_list(server);
 *
 * vector<string> class_list;
 * db_datum >> class_list;
 * @endcode
 *
 * @param [in] ds_name The full device server process name
 * @return The list of Tango classes embedded in the specified server process
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_server_class_list(string &ds_name);
/**
 * Get list of all Tango device server process
 *
 * Return the list of all server names registered in the database.
 * @code
 * DbDatum db_datum = db->get_server_name_list();
 *
 * vector<string> server_list;
 * db_datum >> server_list;
 * @endcode
 *
 * @return The list of all server names
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_server_name_list();
/**
 * Get list of instances
 *
 * Return the list of all instance names existing in the database for the specifed server.
 * @code
 * string servername("Serial");
 *
 * DbDatum db_datum = db->get_instance_name_list(servername);
 *
 * vector<string> instance_list;
 * db_datum >> instance_list;
 * @endcode
 *
 * @param [in] ds_name The device server process executable name
 * @return The list of all instances for the specified device server process
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_instance_name_list(string &ds_name);
/**
 * Get list of device server processes
 *
 * Return the list of all servers registered in the database.
 * @code
 * DbDatum db_datum = db->get_server_list();
 *
 * vector<string> server_list;
 * db_datum >> server_list;
 * @endcode
 *
 * @return The list of all device server processes defined in database
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_server_list();
/**
 * Get list of device server processes with a wildcard
 *
 * Return the list of all servers registered in the database which match the specified wildcard (eg: "Serial/l*").
 * @code
 * string wildcard("Serial/l*");
 *
 * DbDatum db_datum = db->get_server_list(wildcard);
 *
 * vector<string> server_list;
 * db_datum >> server_list;
 * @endcode
 *
 * @param [in] wildcard The wildcard
 * @return The list of device server processes defined in database matching the specified wildcard
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_server_list(string &wildcard);
/**
 * Get list of device server processes running on a host
 *
 * Query the database for a list of servers registred on the specified host.
 * @code
 * string host("kidiboo");
 *
 * DbDatum db_datum = db->get_host_server_list(wildcard);
 *
 * vector<string> server_list;
 * db_datum >> server_list;
 * @endcode
 *
 * @param [in] host_name The host name
 * @return The list of device server processes
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_host_server_list(string &host_name);
/**
 * Get list of devices served by a device server process
 *
 * Query the database for a list of devices served by the specified server (1st parameter)
 * and of the specified class (2nd parameter).
 *
 * @param [in] ds_name The device server name (executable/instance)
 * @param [in] class_name The class name
 * @return The list of devices
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_device_name(string &ds_name, string &class_name);
/**
 * Get list of exported devices
 *
 * Query the database for a list of exported devices whose names satisfy the supplied filter
 * (* is wildcard for any character(s)).
 *
 * @param [in] filter The filter
 * @return The list of exported devices
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_device_exported(string &filter);
/**
 * Get list of device domain names
 *
 * Query the database for a list of device domain names which match the wildcard provided.
 * Wildcard character * matches any number of characters. Domain names are case insensitive.
 *
 * @param [in] wildcard The wildcard
 * @return The device domain names list
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_device_domain(string &wildcard);
/**
 * Get list of device family name
 *
 * Query the database for a list of device family names which match the wildcard provided.
 * Wildcard character * matches any number of characters. Family names are case insensitive.
 *
 * @param [in] wildcard The wildcard
 * @return The device family names list
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_device_family(string &wildcard);
/**
 * Get list of device member name
 *
 * Query the database for a list of device member names which match the wildcard provided.
 * Wildcard character * matches any number of characters. Member names are case insensitive.
 *
 * @param [in] wildcard The wildcard
 * @return The device member names list
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_device_member(string &wildcard);
/**
 * Get list of devices/classes for a specified device server
 *
 * Query the database for a list of devices and classes served by the specified server.
 * Return a list with the following structure: {device name,class name,device name,class name,...}
 * @code
 * string server("Serial/1");
 *
 * DbDatum db_datum = db->get_device_class_list(server);
 *
 * vector<string> dev_list;
 * db_datum >> dev_list;
 * @endcode
 *
 * @param [in] ds_name The full device server process name
 * @return The device / class list
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_device_class_list(string &ds_name);
/**
 * Get list of exported device for a class
 *
 * Query database for list of exported devices for the specified class.
 * @code
 * string classname("MyClass");
 *
 * DbDatum db_datum = db->get_device_exported_for_class(classname);
 *
 * vector<string> dev_list;
 * db_datum >> dev_list;
 * @endcode
 *
 * @param [in] class_name The Tango device class name
 * @return The exported device list
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_device_exported_for_class(string &class_name);
/**
 * Get object (free property) list
 *
 * Query the database for a list of object (free properties) for which properties are defined and which match
 * the specified wildcard.
 * @code
 * string wildcard("Optic*");
 *
 * DbDatum db_datum = db->get_object_list(wildcard);
 *
 * vector<string> obj_list;
 * db_datum >> obj_list;
 * @endcode
 *
 * @param [in] wildcard The wildcard
 * @return The object (free property) list
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_object_list(string &wildcard);
/**
 * Get object property list
 *
 * Query the database for a list of properties defined for the specified object and which match the specified wildcard.
 * @code
 * string objname("OpticID9");
 * string wildcard("Delta*");
 *
 * DbDatum db_datum = db->get_object_property_list(objname,wildcard);
 *
 * vector<string> prop_list;
 * db_datum >> prop_list;
 * @endcode
 *
 * @param [in] obj_name The object (free property) name
 * @param [in] wildcard The wildcard
 * @return The object (free property) property list
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
    DbDatum get_object_property_list(string &obj_name,string &wildcard);
/**
 * Get Tango class list
 *
 * Query the database for a list of classes which match the specified wildcard.
 * @code
 * string wildcard("Motor*");
 *
 * DbDatum db_datum = db->get_class_list(wildcard);
 *
 * vector<string> class_list;
 * db_datum >> class_list;
 * @endcode
 *
 * @param [in] wildcard The wildcard
 * @return The class list
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_class_list(string &wildcard);
/**
 * Get class property list
 *
 * Query the database for a list of properties defined for the specified class.
 * @code
 * string classname("MyClass");
 *
 * DbDatum db_datum = db->get_object_property_list(classname);
 *
 * vector<string> prop_list;
 * db_datum >> prop_list;
 * @endcode
 *
 * @param [in] class_name The class name
 * @return The class property list
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_class_property_list(string &class_name);
/**
 * Get class attribute list
 *
 * Query the database for a list of attributes defined for the specified class which match the specified wildcard.
 * @code
 * string classname("MyClass");
 * string wildcard("*");
 *
 * DbDatum db_datum = db->get_class_attribute_list(classname,wildcard);
 *
 * vector<string> att_list;
 * db_datum >> att_list;
 * @endcode
 *
 * @param [in] class_name The class name
 * @param [in] wildcard The wildcard
 * @return The class property list
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_class_attribute_list(string &class_name,string &wildcard);
/**
 * Get class pipe list
 *
 * Query the database for a list of pipes defined for the specified class which match the specified wildcard.
 * @code
 * string classname("MyClass");
 * string wildcard("*");
 *
 * DbDatum db_datum = db->get_class_pipe_list(classname,wildcard);
 *
 * vector<string> pipe_list;
 * db_datum >> pipe_list;
 * @endcode
 *
 * @param [in] class_name The class name
 * @param [in] wildcard The wildcard
 * @return The class pipe list
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_class_pipe_list(const string &class_name,const string &wildcard);
/**
 * Get device alias list
 *
 * Get device alias list. The parameter is a string to filter the alias list returned. Wildcard (*) is supported.
 * For instance, if the string passed as the method parameter is initialised with only the * character, all
 * the defined device alias will be returned. The DbDatum returned by this method is initialised with an array
 * of strings and must be extracted into a vector<string>. If there is no alias with the given filter, the returned
 * array will have a 0 size.
 * @code
 * DbData db_data;
 * string filter("*");
 *
 * db_data = db->get_device_alias_list(filter);
 *
 * vector<string> al_list;
 * db_data >> al_list;
 *
 * cout << al_list.size() << " device alias defined in db" << endl;
 * for (int i=0;i < al_list.size();i++)
 *     cout << "alias = " << al_list[i] << endl;
 * @endcode
 *
 * @param [in] filter The filter
 * @return The device alias list
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_device_alias_list(string &filter);
/**
 * Get attribute alias list
 *
 * Get attribute alias list. The parameter is a string to filter the alias list returned. Wildcard (*) is
 * supported. For instance, if the string passed as the method parameter is initialised with only the
 * * character, all the defined attribute alias will be returned. The DbDatum returned by this method is
 * initialised with an array of strings and must be extracted into a vector<string>. If there is no alias with the
 * given filter, the returned array will have a 0 size.
 *
 * @param [in] filter The filter
 * @return The attribute alias list
 *
 * @exception ConnectionFailed,CommunicationFailed,DevFailed from device
 */
	DbDatum get_attribute_alias_list(string &filter);
//@}


///@privatesection
	Database(string &host, int port, CORBA::ORB *orb=NULL);
	Database(string &file);

	Database(const Database &);
	Database & operator=(const Database &);

	void write_filedatabase();
	void reread_filedatabase();
	void write_event_channel_ior_filedatabase(string &);
	void build_connection ();
	void post_reconnection();
	~Database();
	inline Device_var &get_dbase() { return device;}
	void check_tango_host(const char *);
	AccessControlType check_access_control(string &);
	bool is_control_access_checked() {return access_checked;}
	void set_access_checked(bool val) {access_checked = val;}

	void set_tango_utils(Tango::Util *ptr) {db_tg=ptr;}
	int get_server_release() {return serv_version;}

	DevErrorList &get_access_except_errors() {return access_except_errors;}
	void clear_access_except_errors() {access_except_errors.length(0);}
	bool is_command_allowed(string &,string &);

	bool is_multi_tango_host() {return db_multi_svc;}
	vector<string> &get_multi_host() {return multi_db_host;}
	vector<string> &get_multi_port() {return multi_db_port;}

	const string &get_file_name();
	const string &get_orig_tango_host() {return ext->orig_tango_host;}
	void set_orig_tango_host(const string &_s) {ext->orig_tango_host=_s;}

#ifdef _TG_WINDOWS_
	Database(CORBA::ORB *orb,string &,string &);
	long get_tango_host_from_reg(char **,string &,string &);
#endif

//
// general methods
//

	CORBA::Any *fill_server_cache(string &,string &);

//
// device methods
//

	DbDatum get_device_name(string &, string &,DbServerCache *dsc);

//
// server methods
//

	DbServerInfo get_server_info(string &);
	void put_server_info(DbServerInfo &);
	void delete_server_info(string &);

//
// property methods
//

	void get_property(string, DbData &,DbServerCache *dsc);
	void get_property_forced(string, DbData &,DbServerCache *dsc = NULL);
	void get_device_property(string, DbData &, DbServerCache *dsc);
	DbDatum get_device_property_list(string &,string &);
	void get_device_property_list(string &,const string &,vector<string> &,DbServerCache *dsc = NULL);
	void get_device_attribute_property(string, DbData &, DbServerCache *dsc);
	void get_device_pipe_property(string, DbData &, DbServerCache *dsc);
	void delete_all_device_attribute_property(string, DbData &);
	void delete_all_device_pipe_property(string, DbData &);
	void get_class_property(string, DbData &, DbServerCache *dsc);
	void get_class_attribute_property(string, DbData &, DbServerCache *dsc);
	void get_class_pipe_property(string, DbData &, DbServerCache *dsc);

//
// event methods
//

	void export_event(DevVarStringArray *);
	void unexport_event(string &);
	CORBA::Any *import_event(string &);

};

//
// Some Database class inline methods
//

inline string Database::dev_name()
{
	if (db_device_name.empty() == true)
	{
		CORBA::String_var n = device->name();
		db_device_name = n;
	}
	return db_device_name;
}

#endif /* _DATABASE_H */