Main Page   Class Hierarchy   Compound List   File List   Compound Members  

C_LogValue.cpp

00001 /*
00002  *  This program is free software; you can redistribute it and/or modify
00003  *  it under the terms of the GNU General Public License as published by
00004  *  the Free Software Foundation; either version 2 of the License, or
00005  *  (at your option) any later version.
00006  *
00007  *  This program is distributed in the hope that it will be useful,
00008  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00009  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010  *  GNU General Public License for more details.
00011  *
00012  *  You should have received a copy of the GNU General Public License
00013  *  along with this program; if not, write to the Free Software
00014  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00015  *
00016  * (c)Copyright 2006 Hewlett-Packard Development Company, LP.
00017  *
00018  */
00019 
00020 #include "C_LogValue.hpp"
00021 #include "Utils.hpp"
00022 #include "string_t.hpp"
00023 
00024 C_LogValue::C_LogValue(char *P_string) {
00025   m_type = E_TYPE_STRING ;
00026   ALLOC_TABLE (m_string,
00027                char*,
00028                sizeof(char),
00029                100);
00030   strncpy(m_string, P_string, 100);
00031 }
00032 C_LogValue::C_LogValue(double P_time, double P_data) {
00033   m_type = E_TYPE_DATA ;
00034   ALLOC_TABLE (m_string,
00035                char*,
00036                sizeof(char),
00037                100);
00038   m_data.m_x = P_time ;
00039   m_data.m_y = P_data ;
00040 }
00041 C_LogValue::~C_LogValue() {
00042   FREE_TABLE (m_string)
00043 }
00044 void C_LogValue::set_string (char *P_string) {
00045   m_type = E_TYPE_STRING ;
00046   strncpy(m_string, P_string, 100);
00047 }
00048 void C_LogValue::set_data (double P_time, double P_data) {
00049   m_type = E_TYPE_DATA ;
00050   m_data.m_x = P_time ;
00051   m_data.m_y = P_data ;
00052 }
00053 void C_LogValue::get_value (char *P_buf) {
00054   switch (m_type) {
00055   case E_TYPE_STRING:
00056     strncpy(P_buf, m_string, 100);
00057     break ;
00058   case E_TYPE_DATA:
00059     snprintf(P_buf, 100, (char*)"%f;%f;", m_data.m_x, 
00060              m_data.m_y);
00061     break ;
00062   }
00063 }

Generated on Wed Mar 7 14:44:50 2007 for Seagull by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002