|
Last change
on this file was
7669,
checked in by westram, 15 years ago
|
- merge from dev [7638] [7639] [7646] [7645] [7647] [7648] [7649] [7650] [7651] [7652]
- compatibility with cppcheck 1.49 (assert + ASSERT_RESULT)
- fixed (AWT and WINDOW)
- missing const attributes
- uninitialized/unused/wrong-scoped/useless variables
- alloc/free/delete mismatches
- use assertions instead of null-pointer-assignments
- removed
- AW_device_Xm fast/slow/fastflag
- new class AW_scalar
- can hold any AW_awar-value
- uses int32_t (AW_awar is based on GB_INT which is 32 bit)
- knows its type
- use in
- AW_option_struct / AW_toggle_struct (both classes were identical → replaced them by new class AW_widget_value_pair)
- in AW_variable_update_struct (now VarUpdateInfo)
- in AW_select_table_struct (now AW_selection_list_entry)
|
|
File size:
1.7 KB
|
| Line | |
|---|
| 1 | // ============================================================ // |
|---|
| 2 | // // |
|---|
| 3 | // File : aw_scalar.cxx // |
|---|
| 4 | // Purpose : Scalar variables (similar to perl scalars) // |
|---|
| 5 | // // |
|---|
| 6 | // Coded by Ralf Westram (coder@reallysoft.de) in June 2011 // |
|---|
| 7 | // Institute of Microbiology (Technical University Munich) // |
|---|
| 8 | // http://www.arb-home.de/ // |
|---|
| 9 | // // |
|---|
| 10 | // ============================================================ // |
|---|
| 11 | |
|---|
| 12 | #include "aw_scalar.hxx" |
|---|
| 13 | #include "aw_awar.hxx" |
|---|
| 14 | #include <arb_msg.h> |
|---|
| 15 | |
|---|
| 16 | AW_scalar::AW_scalar(AW_awar *awar) { |
|---|
| 17 | switch (awar->get_type()) { |
|---|
| 18 | case AW_INT: type = INT; value.i = awar->read_int(); break; |
|---|
| 19 | case AW_FLOAT: type = FLOAT; value.f = awar->read_float(); break; |
|---|
| 20 | case AW_STRING: type = STR; value.s = awar->read_string(); break; |
|---|
| 21 | case AW_POINTER: type = PNTR; value.p = awar->read_pointer(); break; |
|---|
| 22 | default : GBK_terminatef("AWAR type %i unhandled", awar->get_type()); break; |
|---|
| 23 | } |
|---|
| 24 | } |
|---|
| 25 | |
|---|
| 26 | GB_ERROR AW_scalar::write_to(class AW_awar *awar) { |
|---|
| 27 | GB_ERROR error = NULL; |
|---|
| 28 | switch (awar->get_type()) { |
|---|
| 29 | case AW_INT: error = awar->write_int(get_int()); break; |
|---|
| 30 | case AW_FLOAT: error = awar->write_float(get_float()); break; |
|---|
| 31 | case AW_STRING: error = awar->write_string(get_string()); break; |
|---|
| 32 | case AW_POINTER: error = awar->write_pointer(get_pointer()); break; |
|---|
| 33 | default : GBK_terminatef("AWAR type %i unhandled", awar->get_type()); break; |
|---|
| 34 | } |
|---|
| 35 | return error; |
|---|
| 36 | } |
|---|
| 37 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.