# PhasicFlow: src/phasicFlow/eventManagement/subscriber.hpp Source File
PhasicFlow is an open-source parallel DEM (discrete element method) package for simulating granular flow. It is developed in C++ and can be exectued on both GPU (like CUDA) and CPU.

subscriber.hpp
Go to the documentation of this file.
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __subscriber_hpp__
#define __subscriber_hpp__
#include <array>
#include "List.hpp"
#include "message.hpp"
#include "timeInfo.hpp"
namespace pFlow
{
class observer;
class anyList;
class subscriber
{
private:
// - list of subsribed objectd that recieve updage messages
mutable std::array<List<observer*>,message::numEvents()> observerList_;
word subName_;
public:
subscriber(const word& name)
:
subName_(name)
{}
subscriber(const subscriber&);
subscriber(subscriber&&);
subscriber& operator = (const subscriber&);
subscriber& operator = (subscriber&&);
virtual ~subscriber();
virtual bool subscribe(message msg, observer* obsevr)const;
virtual bool unsubscribe(observer* obsevr)const;
bool notify(
uint32 iter,
real t,
real dt,
const message msg,
const anyList& varList);
bool notify(
const timeInfo& ti,
const message msg,
const anyList& varList);
const word& subscriberName()const
{
return subName_;
}
};
} // pFlow
#endif // __eventSubscriber_hpp__
pFlow::observer
Definition: observer.hpp:33
pFlow::subscriber::notify
bool notify(uint32 iter, real t, real dt, const message msg, const anyList &varList)
Definition: subscriber.cpp:126
pFlow::message
Definition: message.hpp:33
pFlow::subscriber::unsubscribe
virtual bool unsubscribe(observer *obsevr) const
Definition: subscriber.cpp:107
pFlow::real
float real
Definition: builtinTypes.hpp:45
timeInfo.hpp
message.hpp
pFlow::subscriber::subscriber
subscriber(const word &name)
Definition: subscriber.hpp:48
List.hpp
pFlow::subscriber::observerList_
std::array< List< observer * >, message::numEvents()> observerList_
Definition: subscriber.hpp:42
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::message::numEvents
static constexpr auto numEvents()
Definition: message.hpp:177
pFlow::subscriber::subName_
word subName_
Definition: subscriber.hpp:44
pFlow::subscriber
Definition: subscriber.hpp:37
pFlow::timeInfo
Definition: timeInfo.hpp:28
pFlow
Definition: demGeometry.hpp:27
pFlow::subscriber::subscribe
virtual bool subscribe(message msg, observer *obsevr) const
Definition: subscriber.cpp:85
pFlow::anyList
Definition: anyList.hpp:35
pFlow::subscriber::subscriberName
const word & subscriberName() const
Definition: subscriber.hpp:85
pFlow::subscriber::~subscriber
virtual ~subscriber()
Definition: subscriber.cpp:70
pFlow::subscriber::operator=
subscriber & operator=(const subscriber &)
Copy assignemnt, only assign the name, do not assign the list.
Definition: subscriber.cpp:48