Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add/update copyright notices.
[simgrid.git] / src / surf / vm_workstation_interface.cpp
index 7a24d2d..46299a4 100644 (file)
@@ -1,9 +1,9 @@
-/*
- * vm_workstation.cpp
- *
- *  Created on: Nov 12, 2013
- *      Author: bedaride
- */
+/* Copyright (c) 2013-2014. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
 #include "vm_workstation_interface.hpp"
 #include "cpu_cas01.hpp"
 
@@ -12,6 +12,14 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_vm_workstation, surf,
 
 WorkstationVMModelPtr surf_vm_workstation_model = NULL;
 
+/*************
+ * Callbacks *
+ *************/
+
+surf_callback(void, WorkstationVMPtr) workstationVMCreatedCallbacks;
+surf_callback(void, WorkstationVMPtr) workstationVMDestructedCallbacks;
+surf_callback(void, WorkstationVMPtr) workstationVMStateChangedCallbacks;
+
 /*********
  * Model *
  *********/
@@ -24,12 +32,25 @@ WorkstationVMModel::WorkstationVMModel() : WorkstationModel("Virtual Workstation
  * Resource *
  ************/
 
+WorkstationVM::WorkstationVM(ModelPtr model, const char *name, xbt_dict_t props,
+                       RoutingEdgePtr netElm, CpuPtr cpu)
+: Workstation(model, name, props, NULL, netElm, cpu)
+{
+  surf_callback_emit(workstationVMCreatedCallbacks, this);
+}
+
 /*
  * A physical host does not disapper in the current SimGrid code, but a VM may
  * disapper during a simulation.
  */
 WorkstationVM::~WorkstationVM()
 {
+  surf_callback_emit(workstationVMDestructedCallbacks, this);
+}
+
+void WorkstationVM::setState(e_surf_resource_state_t state){
+  Resource::setState(state);
+  surf_callback_emit(workstationVMStateChangedCallbacks, this);
 }
 
 /*