Commit 563fa014 authored by claes's avatar claes

Storage server fist version

parent 4fa16fab
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
ifndef link_rule_mk
link_rule_mk := 1
link = $(ldxx) $(elinkflags) $(domap) -o $(export_exe) \
$(export_obj) $(objects) $(wb_msg_eobjs) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o \
-lpwr_sev -lpwr_rt -lpwr_co $(linkmysql)\
-lpwr_msg_dummy \
-lrpcsvc -lpthread -lm -lrt -ldb_cxx -lz -lcrypt
#-lpwr_wb -lpwr_rt -lpwr_ge -lpwr_flow -lpwr_glow -lpwr_co \
# -L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/lib \
# -L/opt/gnome/lib \
# -lantlr -lImlib -lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp\
# -lXmu -lSM -lICE\
endif
This diff is collapsed.
/*
* Proview $Id: sev_server.h,v 1.1 2008-07-17 11:18:31 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef sev_server_h
#define sev_server_h
#include <vector.h>
#include <map.h>
#include "pwr.h"
#include "pwr_class.h"
#include "rt_sev_net.h"
#include "sev_db.h"
class sev_node {
public:
pwr_tNodeId nid;
char name[80];
};
class sev_refid {
public:
sev_refid( pwr_tRefId rid) : id(rid) {}
bool operator<(const sev_refid& x) const {
if ( id.nid < x.id.nid)
return true;
if ( id.rix < x.id.rix)
return true;
return false;
}
pwr_tRefId id;
};
class sev_item_key {
public:
sev_item_key( pwr_tOid oid, char *aname) : m_oid(oid)
{
strncpy( m_aname, aname, sizeof(m_aname));
}
bool operator<(const sev_item_key& x) const {
if ( m_oid.vid < x.m_oid.vid)
return true;
if ( m_oid.oix < x.m_oid.oix)
return true;
return strcmp( m_aname, x.m_aname);
}
pwr_tOid m_oid;
pwr_tAName m_aname;
};
class sev_server {
public:
sev_server() : m_msg_id(0) {}
typedef map<sev_refid, unsigned int>::iterator iterator_refid;
typedef map<sev_item_key, unsigned int>::iterator iterator_item_key;
pwr_tStatus m_sts;
vector<sev_node> m_nodes;
map<sev_refid, unsigned int> m_refid;
map<sev_item_key, unsigned int> m_item_key;
unsigned int m_msg_id;
sev_db *m_db;
int init();
int connect();
int request_items( pwr_tNid nid);
int sev_server::mainloop();
int check_histitems( sev_sMsgHistItems *msg, unsigned int size);
int receive_histdata( sev_sMsgHistDataStore *msg, unsigned int size);
int send_histdata( qcom_sQid tgt, sev_sMsgHistDataGetRequest *msg, unsigned int size);
int send_itemlist( qcom_sQid tgt);
void garbage_collector();
};
#endif
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
ifndef link_rule_mk
link_rule_mk := 1
link = $(ldxx) $(elinkflags) $(domap) -o $(pwr_exe)/sev_xtt_gtk \
$(bld_dir)/sev_xtt_gtk.o \
$(bld_dir)/xtt_tbl_gtk.o $(bld_dir)/xtt_tblnav_gtk.o $(bld_dir)/xtt_tbl.o \
$(bld_dir)/xtt_tblnav.o \
$(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o -L/usr/X11R6/lib\
-L/opt/gnome/lib \
-lpwr_xtt_gtk -lpwr_xtt -lpwr_xtt_gtk -lpwr_xtt -lpwr_ge_gtk -lpwr_ge -lpwr_rt_gtk -lpwr_rt \
-lpwr_co_gtk -lpwr_co -lpwr_flow_gtk -lpwr_flow -lpwr_glow_gtk -lpwr_glow \
`pkg-config --libs gtk+-2.0` \
-lpwr_msg_dummy \
-ldb -lrpcsvc -lpthread -lm -lrt -lcrypt -lasound
endif
/*
* Proview $Id: sev_xtt_gtk.cpp,v 1.1 2008-07-17 11:18:31 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gtk/gtk.h>
#include "pwr.h"
#include "pwr_class.h"
#include "xtt_tbl_gtk.h"
#include "co_error.h"
#include "rt_qcom.h"
#include "rt_errh.h"
#include "rt_sevcli.h"
int main( int argc, char *argv[])
{
pwr_tStatus sts;
qcom_sAid aid;
sevcli_tCtx sevcli;
sevcli_sHistItem *items;
unsigned int itemcnt;
char servername[40] = "";
// Get options
for ( int i = 1; i < argc; i++) {
if ( strcmp( argv[i], "-s") == 0 && i + 1 < argc) {
strncpy( servername, argv[i+1], sizeof(servername));
i++;
}
}
sts = qcom_Init( &sts, &aid, "sev_xtt");
if ( EVEN(sts)) co_error(sts);
sevcli_init( &sts, &sevcli);
if ( EVEN(sts)) co_error(sts);
if ( strcmp(servername, "") != 0)
sevcli_set_servernode( &sts, sevcli, servername);
sevcli_get_itemlist( &sts, sevcli, &items, &itemcnt);
if ( EVEN(sts)) co_error(sts);
gtk_init( &argc, &argv);
new XttTblGtk( 0, 0, sevcli, items, itemcnt);
gtk_main();
return 1;
}
/*
* Proview $Id: xtt_tbl_gtk.cpp,v 1.1 2008-07-17 11:18:31 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
/* xtt_tbl.cpp -- Sev Table Viewer */
#include "glow_std.h"
#include "co_cdh.h"
#include "co_time.h"
#include "co_wow_gtk.h"
#include "flow.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "flow_browwidget_gtk.h"
#include "glow.h"
#include "glow_curvectx.h"
#include "flow_msg.h"
#include "xtt_tbl_gtk.h"
#include "xtt_tblnav_gtk.h"
#include "xtt_dshist_gtk.h"
void XttTblGtk::message( char severity, char *message)
{
gtk_label_set_text( GTK_LABEL(msg_label), message);
}
static gint delete_event( GtkWidget *w, GdkEvent *event, gpointer data)
{
XttTblGtk *xtttbl = (XttTblGtk *)data;
delete xtttbl;
return FALSE;
}
static void destroy_event( GtkWidget *w, gpointer data)
{
// XttTblGtk *xtttbl = (XttTblGtk *)data;
// delete xtttbl;
}
static gboolean xtttbl_focus_in_event( GtkWidget *w, GdkEvent *event, gpointer data)
{
XttTblGtk *xtttbl = (XttTblGtk *)data;
if ( xtttbl->tblnav)
xtttbl->tblnav->set_inputfocus();
return FALSE;
}
static void xtttbl_activate_close( GtkWidget *w, gpointer data)
{
XttTbl *xtttbl = (XttTbl *)data;
delete xtttbl;
}
static void xtttbl_activate_help( GtkWidget *w, gpointer data)
{
}
static void xtttbl_activate_opendshist( GtkWidget *w, gpointer data)
{
((XttTbl *)data)->activate_opendshist();
}
XttDsHist *XttTblGtk::dshist_new( pwr_tOid oid, char *aname)
{
GtkWidget *w;
pwr_tStatus sts;
pwr_tOid oidv[2];
pwr_tOName anamev[2];
oidv[0] = oid;
oidv[1] = pwr_cNOid;
strncpy( anamev[0], aname, sizeof(anamev[0]));
return new XttDsHistGtk( (void *)this, toplevel, "DsHist", &w, oidv, anamev,
sevcli, &sts);
}
XttTblGtk::XttTblGtk( GtkWidget *a_parent_wid,
void *a_parent_ctx,
sevcli_tCtx a_sevcli,
sevcli_sHistItem *itemlist,
int item_cnt) :
XttTbl( a_parent_ctx, a_sevcli),
parent_wid(a_parent_wid)
{
int sts;
toplevel = (GtkWidget *) g_object_new( GTK_TYPE_WINDOW,
"default-height", 700,
"default-width", 500,
"title", "Object Attributes",
NULL);
g_signal_connect( toplevel, "delete_event", G_CALLBACK(delete_event), this);
g_signal_connect( toplevel, "destroy", G_CALLBACK(destroy_event), this);
g_signal_connect( toplevel, "focus-in-event", G_CALLBACK(xtttbl_focus_in_event), this);
CoWowGtk::SetWindowIcon( toplevel);
GtkWidget *vbox = gtk_vbox_new( FALSE, 0);
// Menu
// Accelerators
GtkAccelGroup *accel_g = (GtkAccelGroup *) g_object_new(GTK_TYPE_ACCEL_GROUP, NULL);
gtk_window_add_accel_group(GTK_WINDOW(toplevel), accel_g);
GtkMenuBar *menu_bar = (GtkMenuBar *) g_object_new(GTK_TYPE_MENU_BAR, NULL);
// File entry
GtkWidget *file_close = gtk_image_menu_item_new_from_stock(GTK_STOCK_CLOSE, accel_g);
g_signal_connect(file_close, "activate", G_CALLBACK(xtttbl_activate_close), this);
GtkMenu *file_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_close);
GtkWidget *file = gtk_menu_item_new_with_mnemonic("_File");
gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), file);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(file), GTK_WIDGET(file_menu));
// Functions entry
GtkWidget *functions_opendshist = gtk_menu_item_new_with_mnemonic( "_Open DsHist");
g_signal_connect(functions_opendshist, "activate", G_CALLBACK(xtttbl_activate_opendshist), this);
GtkMenu *functions_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(functions_menu), functions_opendshist);
GtkWidget *functions = gtk_menu_item_new_with_mnemonic("_Functions");
gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), functions);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(functions), GTK_WIDGET(functions_menu));
// Help entry
GtkWidget *help_help = gtk_image_menu_item_new_from_stock(GTK_STOCK_HELP, accel_g);
g_signal_connect(help_help, "activate", G_CALLBACK(xtttbl_activate_help), this);
GtkMenu *help_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
gtk_menu_shell_append(GTK_MENU_SHELL(help_menu), help_help);
GtkWidget *help = gtk_menu_item_new_with_mnemonic("_Help");
gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), help);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(help), GTK_WIDGET(help_menu));
pane = gtk_vpaned_new();
tblnav = new TblNavGtk( this, pane,
itemlist, item_cnt, &brow_widget, &sts);
tblnav->message_cb = &XttTbl::message;
GtkWidget *statusbar = gtk_hbox_new( FALSE, 0);
// msg_label = gtk_statusbar_new();
msg_label = gtk_label_new( "");
gtk_widget_set_size_request( msg_label, -1, 25);
gtk_box_pack_start( GTK_BOX(statusbar), msg_label, FALSE, FALSE, 0);
gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET(menu_bar), FALSE, FALSE, 0);
gtk_box_pack_end( GTK_BOX(vbox), GTK_WIDGET(pane), TRUE, TRUE, 0);
gtk_paned_pack1( GTK_PANED(pane), GTK_WIDGET(brow_widget), TRUE, TRUE);
gtk_paned_pack2( GTK_PANED(pane), GTK_WIDGET(statusbar), FALSE, TRUE);
gtk_container_add( GTK_CONTAINER(toplevel), vbox);
gtk_widget_show_all( toplevel);
int w, h;
gdk_drawable_get_size( pane->window, &w, &h);
gtk_paned_set_position( GTK_PANED(pane), h - 50);
}
XttTblGtk::~XttTblGtk()
{
delete (TblNavGtk *)tblnav;
gtk_widget_destroy( toplevel);
}
/*
* Proview $Id: xtt_tbl_gtk.h,v 1.1 2008-07-17 11:18:31 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#ifndef xtt_tbl_gtk_h
#define xtt_tbl_gtk_h
#include "../src/xtt_tbl.h"
#include "xtt_tblnav_gtk.h"
#include "co_wow_gtk.h"
/* ge_tbl.h -- Ge tblibute editor */
class XttTblGtk : public XttTbl {
public:
XttTblGtk(
GtkWidget *a_parent_wid,
void *a_parent_ctx,
sevcli_tCtx a_sevcli,
sevcli_sHistItem *itemlist,
int item_cnt);
GtkWidget *parent_wid;
GtkWidget *brow_widget;
GtkWidget *form_widget;
GtkWidget *toplevel;
GtkWidget *msg_label;
GtkWidget *pane;
void message( char severity, char *message);
XttDsHist *dshist_new( pwr_tOid oid, char *aname);
~XttTblGtk();
};
#endif
/*
* Proview $Id: xtt_tblnav_gtk.cpp,v 1.1 2008-07-17 11:18:31 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
/* sev_tblnav.cpp -- Sev Table Viewer */
#include "glow_std.h"
#include <stdio.h>
#include <stdlib.h>
#include <vector.h>
#include "co_cdh.h"
#include "co_time.h"
#include "flow.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "flow_browwidget_gtk.h"
#include "flow_msg.h"
#include "glow.h"
#include "glow_growctx.h"
#include "glow_growapi.h"
#include "glow_growwidget_gtk.h"
#include "xtt_tbl_gtk.h"
#include "xtt_tblnav_gtk.h"
//
// Create the navigator widget
//
TblNavGtk::TblNavGtk(
void *xn_parent_ctx,
GtkWidget *xn_parent_wid,
sevcli_sHistItem *xn_itemlist,
int xn_item_cnt,
GtkWidget **w,
pwr_tStatus *status) :
TblNav( xn_parent_ctx, xn_itemlist, xn_item_cnt, status),
parent_wid(xn_parent_wid)
{
form_widget = scrolledbrowwidgetgtk_new(
TblNav::init_brow_cb, this, &brow_widget);
gtk_widget_show_all( brow_widget);
// Create the root item
*w = form_widget;
*status = 1;
}
//
// Delete a nav context
//
TblNavGtk::~TblNavGtk()
{
delete brow;
gtk_widget_destroy( form_widget);
}
void TblNavGtk::set_inputfocus()
{
gtk_widget_grab_focus( brow_widget);
}
/*
* Proview $Id: xtt_tblnav_gtk.h,v 1.1 2008-07-17 11:18:31 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#ifndef xtt_tblnav_gtk_h
#define xtt_tblnav_gtk_h
/* xtt_tblnav_gtk.h -- Simple navigator */
#include <gtk/gtk.h>
#ifndef xtt_tblnav_h
# include "../src/xtt_tblnav.h"
#endif
//! The navigation area of the attribute editor.
class TblNavGtk : public TblNav {
public:
TblNavGtk(
void *xn_parent_ctx,
GtkWidget *xn_parent_wid,
sevcli_sHistItem *xn_itemlist,
int xn_item_cnt,
GtkWidget **w,
pwr_tStatus *status);
~TblNavGtk();
GtkWidget *parent_wid;
GtkWidget *brow_widget;
GtkWidget *form_widget;
GtkWidget *toplevel;
void set_inputfocus();
};
#endif
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
ifndef link_rule_mk
link_rule_mk := 1
link = $(ldxx) $(elinkflags) $(domap) -o $(export_exe) \
$(export_obj) $(wb_msg_eobjs) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o \
-lpwr_sev -lpwr_rt -lpwr_co $(linkmysql)\
-lpwr_msg_dummy \
-lrpcsvc -lpthread -lm -lrt -ldb_cxx -lz -lcrypt
#-lpwr_wb -lpwr_rt -lpwr_ge -lpwr_flow -lpwr_glow -lpwr_co \
# -L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/lib \
# -L/opt/gnome/lib \
# -lantlr -lImlib -lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp\
# -lXmu -lSM -lICE\
endif
/*
* Proview $Id: sev_xtt.cpp,v 1.1 2008-07-17 11:18:31 claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* wb.cpp -- graphical editor */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include "pwr.h"
#include "co_dcli.h"
int main( int argc, char *argv[])
{
int i;
int found = 0;
char wmg[80];
pwr_tFileName file;
if ( argc > 1) {
for ( i = 1; i < argc; i++) {
if ( strcmp( argv[i], "-f") == 0) {
if ( i+1 >= argc) {
printf( "sev_xtt: Syntax error\n");
exit(0);
}
found = 1;
strcpy( wmg, argv[i+1]);
i++;
}
}
}
if ( !found) {
struct stat st;
strcpy( file, "$pwr_exe/sev_xtt_gtk");
dcli_translate_filename( file, file);
if ( stat( file, &st) == 0)
strcpy( wmg, "gtk");
else
strcpy( wmg, "motif");
}
strcpy( file, argv[0]);
strcat( file, "_");
strcat( file, wmg);
execvp( file, argv);
}
/*
* Proview $Id: xtt_tbl.cpp,v 1.1 2008-07-17 11:18:31 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
/* xtt_tbl.cpp -- Display object attributes */
#include "glow_std.h"
#include <stdio.h>
#include <stdlib.h>
#include <vector.h>
#include "co_cdh.h"
#include "co_time.h"
#include "flow.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "glow.h"
#include "glow_growctx.h"
#include "glow_growapi.h"
#include "flow_msg.h"
#include "xtt_tbl.h"
#include "xtt_tblnav.h"
XttTbl::~XttTbl()
{
}
XttTbl::XttTbl( void *xn_parent_ctx, sevcli_tCtx xn_sevcli) :
parent_ctx(xn_parent_ctx), sevcli(xn_sevcli)
{
}
void XttTbl::message( void *xtttbl, char severity, char *message)
{
((XttTbl *)xtttbl)->message( severity, message);
}
void XttTbl::activate_opendshist()
{
sevcli_sHistItem *hi;
tblnav->get_select( &hi);
dshist_new( hi->oid, hi->aname);
}
/*
* Proview $Id: xtt_tbl.h,v 1.1 2008-07-17 11:18:31 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#ifndef xtt_tbl_h
#define xtt_tbl_h
#include "glow.h"
#include "rt_sevcli.h"
/* xtt_tbl.h -- Sev Table Viewer */
class TblNav;
class XttDsHist;
class XttTbl {
public:
XttTbl( void *xn_parent_ctx, sevcli_tCtx xn_sevcli);
void *parent_ctx;
char name[80];
TblNav *tblnav;
sevcli_tCtx sevcli;
virtual void message( char severity, char *message) {}
virtual XttDsHist *dshist_new( pwr_tOid oid, char *aname) { return 0;}
void activate_opendshist();
static void message( void *attr, char severity, char *message);
virtual ~XttTbl();
};
#endif
This diff is collapsed.
/*
* Proview $Id: xtt_tblnav.h,v 1.1 2008-07-17 11:18:31 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#ifndef xtt_tblnav_h
#define xtt_tblnav_h
/* xtt_attrnav.h -- Sev Table Viewer */
#ifndef pwr_h
# include "pwr.h"
#endif
#ifndef flow_h
#include "flow.h"
#endif
#ifndef flow_browctx_h
#include "flow_browapi.h"
#endif
#ifndef rt_qcom_h
#include "rt_qcom.h"
#endif
#ifndef rt_sevcli_h
#include "rt_sevcli.h"
#endif
typedef enum {
tblnav_eItemType_Local,
tblnav_eItemType_LocalAttr
} tblnav_eItemType;
typedef enum {
tblnav_mOpen_All = ~0,
tblnav_mOpen_Attributes = 1 << 1
} tblnav_mOpen;
//! Class for handling of brow.
class TblNavBrow {
public:
TblNavBrow( BrowCtx *brow_ctx, void *xn) : ctx(brow_ctx), tblnav(xn) {};
~TblNavBrow();
BrowCtx *ctx;
void *tblnav;
brow_tNodeClass nc_object;
brow_tNodeClass nc_attr;
flow_sAnnotPixmap *pixmap_leaf;
flow_sAnnotPixmap *pixmap_map;
flow_sAnnotPixmap *pixmap_openmap;
flow_sAnnotPixmap *pixmap_attr;
flow_sAnnotPixmap *pixmap_attrarray;
void free_pixmaps();
void allocate_pixmaps();
void create_nodeclasses();
void brow_setup();
};
//! The navigation area of the attribute editor.
class TblNav {
public:
TblNav( void *xn_parent_ctx,
sevcli_sHistItem *xn_itemlist,
int xn_item_cnt,
pwr_tStatus *status);
virtual ~TblNav();
void *parent_ctx;
TblNavBrow *brow;
sevcli_sHistItem *itemlist;
int item_cnt;
void (*message_cb)( void *, char, char *);
int create_items();
int get_select( sevcli_sHistItem **hi);
virtual void message( char sev, char *text);
virtual void set_inputfocus() {}
static int init_brow_cb( FlowCtx *fctx, void *client_data);
};
//! Item for a normal attribute.
class ItemLocal {
public:
ItemLocal( TblNav *tblnav, sevcli_sHistItem *item, brow_tNode dest, flow_eDest dest_code);
sevcli_sHistItem item;
tblnav_eItemType type;
brow_tNode node;
int open_attributes( TblNav *tblnav, double x, double y);
int close( TblNav *tblnav, double x, double y);
};
class ItemLocalAttr {
public:
ItemLocalAttr( TblNav *tblnav, char *iname, char *ivalue, brow_tNode dest, flow_eDest dest_code);
sevcli_sHistItem item;
tblnav_eItemType type;
brow_tNode node;
};
#endif
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
/*
* Proview $Id: sev_db.h,v 1.1 2008-07-17 11:18:31 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef sev_db_h
#define sev_db_h
#include <vector.h>
#include "pwr.h"
#include "pwr_class.h"
class sev_item {
public:
sev_item() {}
unsigned int id;
char tablename[256];
pwr_tOid oid;
pwr_tOName aname;
pwr_tOName oname;
pwr_tTime cretime;
pwr_tTime uptime;
pwr_tDeltaTime storagetime;
pwr_eType vtype;
unsigned int vsize;
pwr_tRefId sevid;
pwr_tString80 description;
pwr_tString16 unit;
pwr_tFloat32 scantime;
};
class sev_db {
public:
vector<sev_item> m_items;
sev_db() {}
virtual ~sev_db() {}
virtual int check_item( pwr_tStatus *sts, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storatetime, pwr_eType type, unsigned int size,
char *description, char *unit, pwr_tFloat32 scantime, unsigned int *idx)
{ return 0;}
virtual int add_item( pwr_tStatus *sts, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime, pwr_eType type, unsigned int size,
char *description, char *unit, pwr_tFloat32 scantime, unsigned int *idx)
{ return 0;}
virtual int store_value( pwr_tStatus *sts, pwr_tOid oid, char *aname, pwr_eType type,
pwr_tTime time, void *buf, unsigned int size) { return 0;}
virtual int get_values( pwr_tStatus *sts, pwr_tOid oid, char *aname, pwr_eType type,
unsigned int size, pwr_tFloat32 scantime, pwr_tTime *starttime,
pwr_tTime *endtime, int maxsize, pwr_tTime **tbuf, void **vbuf,
unsigned int *bsize) { return 0;}
virtual int get_items( pwr_tStatus *sts) { return 0;}
virtual int delete_old_data( pwr_tStatus *sts, pwr_tOid oid, char *aname,
pwr_tTime limit) { return 0;}
};
#endif
This diff is collapsed.
/*
* Proview $Id: sev_dbms.h,v 1.1 2008-07-17 11:18:31 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef sev_dbms_h
#define sev_dbms_h
#include <vector.h>
#include "pwr.h"
#include "pwr_class.h"
#include "sev_db.h"
#include <mysql/mysql.h>
class sev_dbms_env;
class sev_dbms_env
{
public:
MYSQL *m_con;
char *m_fileName;
static char m_systemName[40];
char *m_host;
char *m_user;
char *m_passwd;
char *m_dbName;
unsigned int m_port;
char *m_socket;
bool m_exists;
sev_dbms_env();
sev_dbms_env(const char *fileName);
sev_dbms_env(const char *host, const char *user, const char *passwd,
const char *dbName, unsigned int port, const char *socket);
sev_dbms_env(const sev_dbms_env &);
void operator = (const sev_dbms_env &);
virtual ~ sev_dbms_env() { close();}
int create(const char *fileName, const char *host, const char *user, const char *passwd,
const char *dbName, unsigned int port, const char *socket);
int open(void);
int open(const char *fileName);
int open(const char *host, const char *user, const char *passwd,
const char *dbName, unsigned int port, const char *socket);
MYSQL *createDb(void);
MYSQL *openDb(void);
bool exists() { return m_exists;}
int close(void);
static int get_systemname();
void fileName(const char *fileName);
void host(const char *host);
void user(const char *user);
void passwd(const char *passwd);
void dbName(const char *dbName);
void port(unsigned int port);
void socket(const char *socket);
static char *dbName(void);
inline char *fileName(void) { return m_fileName;}
char *host(void);
inline char *user(void) { return m_user;}
inline char *passwd(void) { return m_passwd;}
inline unsigned int port(void) { return m_port;}
inline char *socket(void) { return m_socket;}
inline MYSQL *con(void) {
return m_con;
}
private:
int create();
};
class sev_dbms : public sev_db {
public:
sev_dbms_env *m_env;
sev_dbms( sev_dbms_env *env) : m_env(env) {}
~sev_dbms() {}
int check_item( pwr_tStatus *sts, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime, pwr_eType type, unsigned int size,
char *description, char *unit, pwr_tFloat32 scantime, unsigned int *idx);
int add_item( pwr_tStatus *sts, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime, pwr_eType type, unsigned int size,
char *description, char *unit, pwr_tFloat32 scantime, unsigned int *idx);
int store_value( pwr_tStatus *sts, pwr_tOid oid, char *aname, pwr_eType type, pwr_tTime time,
void *buf, unsigned int size);
int get_values( pwr_tStatus *sts, pwr_tOid oid, char *aname, pwr_eType type, unsigned int size,
pwr_tFloat32 scantime, pwr_tTime *starttime, pwr_tTime *endtime,
int maxsize, pwr_tTime **tbuf, void **vbuf, unsigned int *bsize);
int delete_old_data( pwr_tStatus *sts, pwr_tOid oid, char *aname, pwr_tTime limit);
int get_items( pwr_tStatus *sts);
int create_table( pwr_tStatus *sts, pwr_tOid oid, char *aname, pwr_eType type, unsigned int size);
int store_item( pwr_tStatus *sts, char *tabelname, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime, pwr_eType vtype, unsigned int vsize,
char *description, char *unit, pwr_tFloat32 scantime);
char *oid_to_table( pwr_tOid oid, char *aname);
char *pwrtype_to_type( pwr_eType type, unsigned int size);
static int timestr_to_time( char *tstr, pwr_tTime *ts);
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment