- Completed my part of auditing

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1215 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
elvez 2006-09-16 23:47:45 +00:00
parent 43d4bdbed8
commit b3e76d99b6
8 changed files with 132 additions and 58 deletions

View File

@ -20,9 +20,10 @@
#include "config.h" #include "config.h"
#include <sgpemv2/plugin.hh>
#include "xml_serializer.hh" #include "xml_serializer.hh"
#include <sgpemv2/plugin.hh>
using namespace sgpem; using namespace sgpem;
sgpem::XMLSerializer* _serializer = NULL; sgpem::XMLSerializer* _serializer = NULL;

View File

@ -25,10 +25,9 @@ namespace sgpem
{ {
class Request; class Request;
class Thread; class Thread;
class AddRequestDialog;
} }
#include <gtkmm/treeview.h> #include <gtkmm/treeview.h>
#include <gtkmm/liststore.h> #include <gtkmm/liststore.h>
#include <gtkmm/dialog.h> #include <gtkmm/dialog.h>
@ -38,32 +37,70 @@ namespace sgpem
namespace sgpem namespace sgpem
{ {
/** \brief A dialog derived from add-request-dialog.glade
*
* Manages the list of subrequests, ensures only "nonempty" requests
* are created, and supports also editing.
*/
class AddRequestDialog : public Gtk::Dialog class AddRequestDialog : public Gtk::Dialog
{ {
public: public:
/** \brief Constructor required by libglademm
*/
AddRequestDialog(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade); AddRequestDialog(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade);
/** /** \brief Attemts to show the dialog, and constructs a new request
\brief Attemts to show the dialog, and constructs a request * if response is OK
if response is OK * \param owner The thread which will own the request
\param owner The thread which will own the request * \return A pointer to the created request, or NULL if the request
* wasn't created
*/ */
Request* run_add(Thread& owner); Request* run_add(Thread& owner);
/** /** \brief Attemts to show the dialog to modify an existing request
\brief Attemts to show the dialog, and modify an existing request * \param request The request to modify
if response is OK
\param resource The request to modify
*/ */
void run_edit(Request& resource); void run_edit(Request& request);
private: private:
/** \brief Fills the combo model with data from the latest
* Environment
*/
void update_combo(); void update_combo();
/** \brief Called when the "add subrequest" button is pressed
*/
void _on_add(); void _on_add();
/** \brief Called when the "remove subrequest" button is pressed
*/
void _on_remove(); void _on_remove();
/** \brief Called when list selection changes
*
* Ensures the "remove subrequest" button is sensitive only
* if a subrequest is selected
*/
void _on_list_selection_changed(); void _on_list_selection_changed();
/** \brief Called when a row is added to the subrequest list
*
* Ensures the OK button is sensitive since we are sure there is at
* least a subrequest
*/
void _on_row_added(const Gtk::TreePath& path, const Gtk::TreeIter& it); void _on_row_added(const Gtk::TreePath& path, const Gtk::TreeIter& it);
/** \brief Called when a row is removed from the subrequest list
*
* Ensures the OK button is no more sensitive if the last item was removed
*/
void _on_row_removed(const Gtk::TreePath& path); void _on_row_removed(const Gtk::TreePath& path);
/** \brief Called when the combo selection changes
*
* Ensures the "add subrequest" button is sensitive only
* if a resource is selected
*/
void _on_combo_selection_changed(); void _on_combo_selection_changed();
Glib::RefPtr<Gnome::Glade::Xml> _glade; Glib::RefPtr<Gnome::Glade::Xml> _glade;

View File

@ -21,36 +21,60 @@
#ifndef DYNAMIC_SUB_REQUEST_HH #ifndef DYNAMIC_SUB_REQUEST_HH
#define DYNAMIC_SUB_REQUEST_HH 1 #define DYNAMIC_SUB_REQUEST_HH 1
#include <sgpemv2/request.hh>
#include <sgpemv2/sub_request.hh>
#include "dynamic_request.hh"
#include "dynamic_resource.hh"
#include "static_sub_request.hh"
#include <sgpemv2/templates/smartp.hh>
namespace sgpem namespace sgpem
{ {
class DynamicSubRequest; class DynamicSubRequest;
class SerializeVisitor; class SerializeVisitor;
class Resource; class Resource;
class StaticSubRequest; class StaticSubRequest;
}
#include "dynamic_request.hh"
#include "dynamic_resource.hh"
#include "static_sub_request.hh"
#include <sgpemv2/request.hh>
#include <sgpemv2/sub_request.hh>
#include <sgpemv2/templates/smartp.hh>
namespace sgpem
{
/** \brief Represents the dynamic status of a subrequest
*/
class SG_DLLLOCAL DynamicSubRequest : public SubRequest class SG_DLLLOCAL DynamicSubRequest : public SubRequest
{ {
public: public:
DynamicSubRequest(StaticSubRequest* core, /** \brief Constructor
DynamicRequest* owner); *
* Only ::History knows how to use this :-).
*/
DynamicSubRequest(StaticSubRequest* core, DynamicRequest* owner);
/** \brief "Special" copy constructor, which copies everything except owner
* \param owner The owner of the new DynamicSubRequest
*/
DynamicSubRequest(const DynamicSubRequest& other, DynamicRequest* owner); DynamicSubRequest(const DynamicSubRequest& other, DynamicRequest* owner);
virtual ~DynamicSubRequest(); virtual ~DynamicSubRequest();
/** \brief Tells if this object equals another of the same type
*
* \return true If they own a reference to the same Static object
* \return false Otherwise
*/
virtual bool operator==(const SubRequest& op2) const; virtual bool operator==(const SubRequest& op2) const;
/** \brief Returns the key to the DynamicResource that was requested
*
* The correct ::Resource object can be obtained via
* Environment.get_resources(), using the returned value as a key
*/
resource_key_t get_resource_key() const; resource_key_t get_resource_key() const;
/** \brief Returns the time the resource is needed
*
* This time is meant relative to a process executed time.
*/
unsigned int get_length() const; unsigned int get_length() const;
int get_queue_position() const; int get_queue_position() const;
@ -62,6 +86,9 @@ namespace sgpem
state set_state(state new_state); state set_state(state new_state);
unsigned int get_remaining_time() const; unsigned int get_remaining_time() const;
/** \brief Decreases remaining time by 1
*/
unsigned int decrease_remaining_time(); unsigned int decrease_remaining_time();
void serialize(SerializeVisitor& translator) const; void serialize(SerializeVisitor& translator) const;

View File

@ -1,4 +1,4 @@
// src/backend/history_observer.hh - Copyright 2005, 2006, University // src/backend/sgpemv2/history_observer.hh - Copyright 2005, 2006, University
// of Padova, dept. of Pure and Applied // of Padova, dept. of Pure and Applied
// Mathematics // Mathematics
// //
@ -21,16 +21,28 @@
#ifndef HISTORY_OBSERVER_HH #ifndef HISTORY_OBSERVER_HH
#define HISTORY_OBSERVER_HH 1 #define HISTORY_OBSERVER_HH 1
#include <sgpemv2/sgpemv2-visibility.hh>
namespace sgpem namespace sgpem
{ {
class History; class History;
class HistoryObserver; class HistoryObserver;
}
#include <sgpemv2/sgpemv2-visibility.hh>
namespace sgpem
{
/** \brief Specifies that the object wants to be notified
* whenever backend::History changes
*
* Observers need to register to an History if they want to be
* notified.
* \see History
*/
class SG_DLLEXPORT HistoryObserver class SG_DLLEXPORT HistoryObserver
{ {
public: public:
/** \brief Called on an History update
*/
virtual void update(const History& changed_history) = 0; virtual void update(const History& changed_history) = 0;
virtual ~HistoryObserver(); virtual ~HistoryObserver();

View File

@ -21,8 +21,6 @@
#ifndef CAIRO_WIDGET_HH #ifndef CAIRO_WIDGET_HH
#define CAIRO_WIDGET_HH 1 #define CAIRO_WIDGET_HH 1
#include <cairo.h> #include <cairo.h>
#include <gtkmm/drawingarea.h> #include <gtkmm/drawingarea.h>
#include <gtkmm/widget.h> #include <gtkmm/widget.h>

View File

@ -24,23 +24,20 @@
#include "gettext.h" #include "gettext.h"
#include "cairo_widget.hh"
#include "holt_widget.hh"
#include <sgpemv2/simulation.hh>
#include <gtkmm/window.h> #include <gtkmm/window.h>
#include <cassert> #include <cassert>
#include <iostream> #include <iostream>
#include <sgpemv2/simulation.hh> namespace sgpem
#include "cairo_widget.hh" {
#include "holt_widget.hh" /** \brief Contains and controls the holt widget
*/
namespace sgpem {
// ------------------------------------------------------
//
// HoltContainerWindow class
//
// contains and controls the tested holt widget
//
// ------------------------------------------------------
class HoltContainerWindow : public Gtk::Window class HoltContainerWindow : public Gtk::Window
{ {
public: public:

View File

@ -42,33 +42,38 @@ main(int argc, char* argv[])
using namespace std; using namespace std;
using Glib::ustring; using Glib::ustring;
#ifndef _MSC_VER // FIXME disable gettext in Windows under Visual Studio
// we currently have no time to port also this thing
#ifndef _MSC_VER
// Set up gettext support // Set up gettext support
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR); bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE); textdomain(PACKAGE);
#endif #endif
// mainly for debugging in Windows, where the type and
// content of uncaught exceptions is not easily
// obtainable
#ifndef NDEBUG #ifndef NDEBUG
try try
{ {
#endif #endif
// Set up Glib thread support // Set up Glib thread support
Glib::thread_init(); Glib::thread_init();
// Parses options and prepares vector with // Parses options and prepares vector with
// filenames of documents to be opened // filenames of documents to be opened
parse_options(argc, argv); parse_options(argc, argv);
#ifndef NDEBUG #ifndef NDEBUG
} }
catch(const std::exception& exp) catch(const std::exception& exp)
{ {
std::cerr << exp.what() << std::endl; std::cerr << exp.what() << std::endl;
} }
catch(const Glib::Exception& gexp) catch(const Glib::Exception& gexp)
{ {
std::cerr << gexp.what() << std::endl; std::cerr << gexp.what() << std::endl;
} }
#endif #endif

View File

@ -1,4 +1,4 @@
// src/testsuite/test-stepforward.cc - Copyright 2005, 2006, University // src/testsuite/test-key_file.cc - Copyright 2005, 2006, University
// of Padova, dept. of Pure and Applied // of Padova, dept. of Pure and Applied
// Mathematics // Mathematics
// //
@ -21,15 +21,12 @@
/* This executable tests for workingness of the save preferences method, /* This executable tests for workingness of the save preferences method,
* and nothing else. */ * and nothing else. */
#include "glibmm/ustring.h"
#include <sgpemv2/key_file.hh> #include <sgpemv2/key_file.hh>
#include <glibmm/ustring.h>
#include <iostream> #include <iostream>
// from here and further until the bottom, all to throw away I suppose
int int
main(int argc, char** argv) main(int argc, char** argv)
{ {