/usr/include/tango/attrdesc.h is in libtango8-dev 8.1.2c+dfsg-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | //=============================================================================
//
// file : attrdesc.h
//
// description : Include file for the Attr classes hierarchy.
// Three classes are declared in this file :
// The Attr class
// The SpectrumAttr class
// The ImageAttr class
//
// project : TANGO
//
// author(s) : A.Gotz + E.Taurel
//
// Copyright (C) : 2004,2005,2006,2007,2008,2009,2010,2011,2012,2013
// 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: 22213 $
//
//=============================================================================
#ifndef _ATTRDESC_H
#define _ATTRDESC_H
#include <tango.h>
namespace Tango
{
class AttrProperty;
class WAttribute;
/**
* User class to set attribute default properties.
*
* This class is used to set attribute default properties. Three levels of
* attributes properties setting are implemented within Tango. The highest
* property setting level is the database. Then the user default (set using
* this UserDefaultAttrProp class) and finally a Tango library default
* value
*
* $Author: taurel $
* $Revision: 22213 $
*
* @headerfile tango.h
* @ingroup Server
*/
class UserDefaultAttrProp
{
public:
/**@name Constructor
* Only one constructor is defined for this class */
//@{
/**
* Constructs a newly allocated UserDefaultAttrProp object.
*/
UserDefaultAttrProp():ext(Tango_NullPtr) {}
//@}
/**@name Set default property methods */
//@{
/**
* Set default label property
*
* @param def_label The user default label property
*/
void set_label(const char *def_label)
{
label = def_label;
}
/**
* Set default description property
*
* @param def_desc The user default description property
*/
void set_description(const char *def_desc)
{
description = def_desc;
}
/**
* Set default unit property
*
* @param def_unit The user default unit property
*/
void set_unit(const char *def_unit)
{
unit = def_unit;
}
/**
* Set default standard unit property
*
* @param def_std_unit The user default standard unit property
*/
void set_standard_unit(const char *def_std_unit)
{
standard_unit = def_std_unit;
}
/**
* Set default display unit property
*
* @param def_disp_unit The user default display unit property
*/
void set_display_unit(const char *def_disp_unit)
{
display_unit = def_disp_unit;
}
/**
* Set default format property
*
* @param def_format The user default format property
*/
void set_format(const char *def_format)
{
format = def_format;
}
/**
* Set default min_value property
*
* @param def_min_value The user default min_value property
*/
void set_min_value(const char *def_min_value)
{
min_value = def_min_value;
}
/**
* Set default max_value property
*
* @param def_max_value The user default max_value property
*/
void set_max_value(const char *def_max_value)
{
max_value = def_max_value;
}
/**
* Set default min_alarm property
*
* @param def_min_alarm The user default min_alarm property
*/
void set_min_alarm(const char *def_min_alarm)
{
min_alarm = def_min_alarm;
}
/**
* Set default max_alarm property
*
* @param def_max_alarm The user default max_alarm property
*/
void set_max_alarm(const char *def_max_alarm)
{
max_alarm = def_max_alarm;
}
/**
* Set default min_warning property
*
* @param def_min_warning The user default min_warning property
*/
void set_min_warning(const char *def_min_warning)
{
min_warning = def_min_warning;
}
/**
* Set default max_warning property
*
* @param def_max_warning The user default max_warning property
*/
void set_max_warning(const char *def_max_warning)
{
max_warning = def_max_warning;
}
/**
* Set default RDS alarm delta_t property
*
* @param def_delta_t The user default RDS alarm delta_t property
*/
void set_delta_t(const char *def_delta_t)
{
delta_t = def_delta_t;
}
/**
* Set default RDS alarm delta_val property
*
* @param def_delta_val The user default RDS alarm delta_val property
*/
void set_delta_val(const char *def_delta_val)
{
delta_val = def_delta_val;
}
/**
* Set default change event abs_change property
*
* @param def_abs_change The user default change event abs_change property
*/
void set_event_abs_change(const char *def_abs_change)
{
abs_change = def_abs_change;
}
/**
* Set default change event rel_change property
*
* @param def_rel_change The user default change event rel_change property
*/
void set_event_rel_change(const char *def_rel_change)
{
rel_change = def_rel_change;
}
/**
* Set default periodic event period property
*
* @param def_period The user default periodic event period property
*/
void set_event_period(const char *def_period)
{
period = def_period;
}
/**
* Set default archive event abs_change property
*
* @param def_archive_abs_change The user default archive event abs_change property
*/
void set_archive_event_abs_change(const char *def_archive_abs_change)
{
archive_abs_change = def_archive_abs_change;
}
/**
* Set default archive event rel_change property
*
* @param def_archive_rel_change The user default archive event rel_change property
*/
void set_archive_event_rel_change(const char *def_archive_rel_change)
{
archive_rel_change = def_archive_rel_change;
}
/**
* Set default archive event period property
*
* @param def_archive_period The user default archive event period property
*/
void set_archive_event_period(const char *def_archive_period)
{
archive_period = def_archive_period;
}
//@}
/// @privatesection
~UserDefaultAttrProp() {}
void set_abs_change(const char *def_abs_change)
{
set_event_abs_change(def_abs_change);
}
void set_rel_change(const char *def_rel_change)
{
set_event_rel_change(def_rel_change);
}
void set_period(const char *def_period)
{
set_event_period(def_period);
}
void set_archive_abs_change(const char *def_archive_abs_change)
{
set_archive_event_abs_change(def_archive_abs_change);
}
void set_archive_rel_change(const char *def_archive_rel_change)
{
set_archive_event_rel_change(def_archive_rel_change);
}
void set_archive_period(const char *def_archive_period)
{
set_archive_event_period(def_archive_period);
}
string label;
string description;
string unit;
string standard_unit;
string display_unit;
string format;
string min_value;
string max_value;
string min_alarm;
string max_alarm;
string min_warning;
string max_warning;
string delta_val;
string delta_t;
string abs_change;
string rel_change;
string period;
string archive_abs_change;
string archive_rel_change;
string archive_period;
private:
class UserDefaultAttrPropExt
{
};
#ifdef HAS_UNIQUE_PTR
unique_ptr<UserDefaultAttrPropExt> ext; // Class extension
#else
UserDefaultAttrPropExt *ext;
#endif
};
/**
* User class to create a no dimension attribute object.
*
* Information from this class and information fetched out from the Tango
* database allows the Tango core software to create the Attribute object
* for the attribute created by the user.
*
* $Author: taurel $
* $Revision: 22213 $
*
* @headerfile tango.h
* @ingroup Server
*/
class Attr
{
public:
/**@name Constructors
* Two constructor are defined for this class */
//@{
/**
* Constructs a newly allocated Attr object.
* The attribute display level is set to OPERATOR.
*
* @param name The attribute name
* @param data_type The attribute data type
* @param w_type The attribute type (read, write, read with write ...)
* @param assoc Name of the associated writable attribute. This is used
* only the read with write attribute
*
*/
Attr(const char *name,long data_type,
Tango::AttrWriteType w_type = Tango::READ,
const char *assoc = AssocWritNotSpec);
/**
* Constructs a newly allocated Attr object.
*
* @param name The attribute name
* @param data_type The attribute data type
* @param disp The attribute display level
* @param w_type The attribute type (read, write, read with write ...)
* @param assoc Name of the associated writable attribute. This is used
* only the read with write attribute
*
*/
Attr(const char *name,long data_type,Tango::DispLevel disp,
Tango::AttrWriteType w_type = Tango::READ,
const char *assoc = AssocWritNotSpec);
//@}
/**@name Destructor
* Only one desctructor is defined for this class */
//@{
/**
* The object desctructor.
*/
virtual ~Attr();
//@}
/**@name Miscellaneous methods*/
//@{
/**
* Set default attribute properties
*
* @param prop The user default property class
*/
void set_default_properties(UserDefaultAttrProp &prop);
/**
* Set the attribute display level
*
* @param level The attribute display level
*/
void set_disp_level(Tango::DispLevel level) {ext->disp_level = level;}
/**
* Set the attribute polling update period
*
* @param update The attribute polling period (in mS)
*/
void set_polling_period(long update) {ext->poll_period = update;}
/**
* Set the attribute as memorized in database (only for scalar and writable
* attribute)
* With no argument the setpoint will be written to the attribute during initialisation!
*/
void set_memorized();
/**
* Set the initialisation flag for memorized attributes
* true = the setpoint value will be written to the attribute on initialisation
* false = only the attribute setpoint is initialised. No action is taken on the attribute
*
* @param write_on_init If true the setpoint value will be written to the attribute on initialisation
*/
void set_memorized_init(bool write_on_init) {mem_init = write_on_init;}
/**
* Set a flag to indicate that the server fires change events manually without
* the polling to be started for the attribute.
* If the detect parameter is set to true, the criteria specified for the change
* event are verified and the event is only pushed if they are fullfilled.
* If detect is set to false the event is fired without checking!
*
* @param implemented True when the server fires change events manually.
* @param detect Triggers the verification of the change event properties when set to true.
*/
void set_change_event(bool implemented, bool detect)
{ ext->fire_change_event = implemented;
ext->check_change_event = detect; }
/**
* Check if the change event is fired manually for this attribute.
*
* @return A boolean set to true if a manual fire change event is implemented.
*/
bool is_change_event() {return ext->fire_change_event;}
/**
* Check if the change event criteria should be checked when firing
* the event manually.
*
* @return A boolean set to true if a change event criteria will be checked.
*/
bool is_check_change_criteria() {return ext->check_change_event;}
/**
* Set a flag to indicate that the server fires archive events manually without
* the polling to be started for the attribute
* If the detect parameter is set to true, the criteria specified for the archive
* event are verified and the event is only pushed if they are fullfilled.
* If detect is set to false the event is fired without checking!
*
* @param implemented True when the server fires archive events manually.
* @param detect Triggers the verification of the archive event properties when set to true.
*/
void set_archive_event(bool implemented, bool detect)
{ext->fire_archive_event = implemented;
ext->check_archive_event = detect;}
/**
* Check if the archive event is fired manually for this attribute.
*
* @return A boolean set to true if a manual fire archive event is implemented.
*/
bool is_archive_event() {return ext->fire_archive_event;}
/**
* Check if the archive event criteria should be checked when firing
* the event manually.
*
* @return A boolean set to true if a archive event criteria will be checked.
*/
bool is_check_archive_criteria() {return ext->check_archive_event;}
/**
* Set a flag to indicate that the server fires data ready events
*
* @param implemented True when the server fires data ready events
*/
void set_data_ready_event(bool implemented) { ext->fire_dr_event = implemented;}
/**
* Check if the data ready event is fired for this attribute.
*
* @return A boolean set to true if firing data ready event is implemented.
*/
bool is_data_ready_event() {return ext->fire_dr_event;}
//@}
/// @privatesection
string &get_name() {return name;}
Tango::AttrDataFormat get_format() {return format;}
Tango::AttrWriteType get_writable() {return writable;}
long get_type() {return type;}
Tango::DispLevel get_disp_level() {return ext->disp_level;}
long get_polling_period() {return ext->poll_period;}
bool get_memorized() {return mem;}
bool get_memorized_init() {return mem_init;}
string &get_assoc() {return assoc_name;}
const string &get_cl_name() {return ext->cl_name;}
void set_cl_name(const string &cl) {ext->cl_name = cl;}
bool is_assoc() {if (assoc_name != AssocWritNotSpec)return true;else return false;}
vector<AttrProperty> &get_class_properties() {return class_properties;}
vector<AttrProperty> &get_user_default_properties() {return user_default_properties;}
void set_class_properties(vector<AttrProperty> &in_prop) {class_properties=in_prop;}
void check_type();
virtual void read(DeviceImpl *,Attribute &) {};
virtual void write(DeviceImpl *,WAttribute &) {};
virtual bool is_allowed(DeviceImpl *,AttReqType) {return true;}
#ifndef TANGO_HAS_LOG4TANGO
friend ostream &operator<<(ostream &,const Attr &);
#endif
protected:
/// @privatesection
string name;
Tango::AttrDataFormat format;
Tango::AttrWriteType writable;
long type;
string assoc_name;
bool mem;
bool mem_init;
vector<AttrProperty> class_properties;
vector<AttrProperty> user_default_properties;
void convert_def_prop(const string &, double &);
void validate_def_prop(const string &, const char *);
void validate_def_change_prop(const string &, const char *);
void throw_incoherent_def_prop(const char *, const char *);
void throw_invalid_def_prop(const char *, const char *);
private:
class AttrExt
{
public:
AttrExt():poll_period(0),fire_change_event(false),fire_archive_event(false),
check_change_event(false),check_archive_event(false),
fire_dr_event(false),cl_name("Attr")
{disp_level = Tango::OPERATOR;}
AttrExt(DispLevel level):poll_period(0),fire_change_event(false),fire_archive_event(false),
check_change_event(false),check_archive_event(false),
fire_dr_event(false),cl_name("Attr")
{disp_level = level;}
Tango::DispLevel disp_level; // Display level
long poll_period; // Polling period
bool fire_change_event;
bool fire_archive_event;
bool check_change_event;
bool check_archive_event;
bool fire_dr_event;
string cl_name;
};
#ifdef HAS_UNIQUE_PTR
unique_ptr<AttrExt> ext; // Class extension
#else
AttrExt *ext;
#endif
};
/**
* User class to create a one dimension attribute object.
*
* Information from this class and information fetched out from the Tango
* database allows the Tango core software to create the Attribute object
* for the attribute created by the user.
*
* $Author: taurel $
* $Revision: 22213 $
*
* @headerfile tango.h
* @ingroup Server
*/
class SpectrumAttr: public Attr
{
public:
/**@name Constructors
* Two constructors are defined for this class */
//@{
/**
* Constructs a newly allocated SpectrumAttr object.
* The attribute display level is set to OPERATOR.
* The attribute write type is set to READ
*
* @param name The attribute name
* @param data_type The attribute data type
* @param max_x The attribute maximum x dimension
*
*/
SpectrumAttr(const char *name,long data_type,long max_x);
/**
* Constructs a newly allocated SpectrumAttr object.
* The attribute display level is set to OPERATOR.
*
* @param name The attribute name
* @param data_type The attribute data type
* @param w_type The attribute write type (READ, WRITE, READ_WRITE)
* @param max_x The attribute maximum x dimension
*
*/
SpectrumAttr(const char *name,long data_type,Tango::AttrWriteType w_type,long max_x);
/**
* Constructs a newly allocated SpectrumAttr object.
* The attribute write type is set to READ
*
* @param name The attribute name
* @param data_type The attribute data type
* @param max_x The attribute maximum x dimension
* @param level The attribute display type
*
*/
SpectrumAttr(const char *name,long data_type,long max_x,DispLevel level);
/**
* Constructs a newly allocated SpectrumAttr object.
*
* @param name The attribute name
* @param data_type The attribute data type
* @param w_type The attribute write type (READ, WRITE, READ_WRITE)
* @param max_x The attribute maximum x dimension
* @param level The attribute display type
*
*/
SpectrumAttr(const char *name,long data_type,Tango::AttrWriteType w_type,long max_x,DispLevel level);
//@}
/**@name Destructor
* Only one desctructor is defined for this class */
//@{
/**
* The object desctructor.
*/
~SpectrumAttr() {}
//@}
/// @privatesection
long get_max_x() {return max_x;}
protected:
long max_x;
private:
class SpectrumAttrExt
{
};
#ifdef HAS_UNIQUE_PTR
unique_ptr<SpectrumAttrExt> ext; // Class extension
#else
SpectrumAttrExt *ext;
#endif
};
/**
* User class to create a two dimensions attribute object.
*
* Information from this class and information fetched out from the Tango
* database allows the Tango core software to create the Attribute object
* for the attribute created by the user.
*
* $Author: taurel $
* $Revision: 22213 $
*
* @headerfile tango.h
* @ingroup Server
*/
class ImageAttr: public SpectrumAttr
{
public:
/**@name Constructors
* Two constructors are defined for this class */
//@{
/**
* Constructs a newly allocated ImageAttr object.
* The attribute display level is set to OPERATOR.
* The attribute write type is set to READ
*
* @param name The attribute name
* @param data_type The attribute data type
* @param max_x The attribute maximum x dimension
* @param max_y The attribute maximum y dimension
*
*/
ImageAttr(const char *name,long data_type,long max_x, long max_y);
/**
* Constructs a newly allocated ImageAttr object.
* The attribute display level is set to OPERATOR.
* The attribute write type is set to READ
*
* @param name The attribute name
* @param data_type The attribute data type
* @param w_type The attribute write type (READ, WRITE, READ_WRITE)
* @param max_x The attribute maximum x dimension
* @param max_y The attribute maximum y dimension
*
*/
ImageAttr(const char *name,long data_type,Tango::AttrWriteType w_type,long max_x, long max_y);
/**
* Constructs a newly allocated ImageAttr object.
* The attribute write type is set to READ
*
* @param name The attribute name
* @param data_type The attribute data type
* @param max_x The attribute maximum x dimension
* @param max_y The attribute maximum y dimension
* @param level The attribute display type
*
*/
ImageAttr(const char *name,long data_type,long max_x,
long max_y, Tango::DispLevel level);
/**
* Constructs a newly allocated ImageAttr object.
* The attribute write type is set to READ
*
* @param name The attribute name
* @param data_type The attribute data type
* @param w_type The attribute write type (READ, WRITE, READ_WRITE)
* @param max_x The attribute maximum x dimension
* @param max_y The attribute maximum y dimension
* @param level The attribute display type
*
*/
ImageAttr(const char *name,long data_type,Tango::AttrWriteType w_type,
long max_x, long max_y, Tango::DispLevel level);
//@}
/**@name Destructor
* Only one desctructor is defined for this class */
//@{
/**
* The object desctructor.
*/
~ImageAttr() {}
//@}
/// @privatesection
long get_max_y() {return max_y;}
protected:
/// @privatesection
long max_y;
private:
class ImageAttrExt
{
};
#ifdef HAS_UNIQUE_PTR
unique_ptr<ImageAttrExt> ext; // Class extension
#else
ImageAttrExt *ext;
#endif
};
} // End of Tango namespace
#endif /* _ATTRDESC_H */
|