Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
plug a memleak around instr
[simgrid.git] / src / simix / popping_private.h
index 542adbf..389f89b 100644 (file)
@@ -1,15 +1,19 @@
-/* Copyright (c) 2007-2010, 2012-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2007-2017. 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. */
 
-#ifndef _POPPING_PRIVATE_H
-#define _POPPING_PRIVATE_H
+#ifndef SG_POPPING_PRIVATE_H
+#define SG_POPPING_PRIVATE_H
 
 #include <xbt/base.h>
 #include <simgrid/simix.h>
 
+#include <src/kernel/activity/ActivityImpl.hpp>
+#include <src/kernel/activity/CommImpl.hpp>
+
+#include <boost/intrusive_ptr.hpp>
+
 SG_BEGIN_DECL()
 
 /********************************* Simcalls *********************************/
@@ -119,6 +123,19 @@ T* unmarshal(type<T*>, u_smx_scalar const& simcall)
   return static_cast<T*>(simcall.dp);
 }
 
+template <class T>
+inline void marshal(type<boost::intrusive_ptr<T>>, u_smx_scalar& simcall, boost::intrusive_ptr<T> value)
+{
+  intrusive_ptr_add_ref(&*value);
+  simcall.dp = static_cast<void*>(&*value);
+}
+template <class T> inline boost::intrusive_ptr<T> unmarshal(type<boost::intrusive_ptr<T>>, u_smx_scalar const& simcall)
+{
+  boost::intrusive_ptr<T> res = boost::intrusive_ptr<T>(static_cast<T*>(simcall.dp), false);
+  intrusive_ptr_release(&*res);
+  return res;
+}
+
 template<class R, class... T> inline
 void marshal(type<R(*)(T...)>, u_smx_scalar& simcall, R(*value)(T...))
 {