Skip to content

Commit

Permalink
Apply clang-format.
Browse files Browse the repository at this point in the history
  • Loading branch information
geektoni committed Jul 11, 2017
1 parent 6f1603a commit 4ad2814
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 42 deletions.
5 changes: 2 additions & 3 deletions src/shogun/base/SGObject.cpp
Expand Up @@ -28,8 +28,8 @@
#include <stdlib.h>
#include <stdio.h>

#include <rxcpp/rx-lite.hpp>
#include <rxcpp/operators/rx-filter.hpp>
#include <rxcpp/rx-lite.hpp>

#ifdef HAVE_CXX11
#include <unordered_map>
Expand Down Expand Up @@ -153,8 +153,7 @@ namespace shogun

using namespace shogun;

CSGObject::CSGObject()
: self()
CSGObject::CSGObject() : self()
{
init();
set_global_objects();
Expand Down
26 changes: 16 additions & 10 deletions src/shogun/base/SGObject.h
Expand Up @@ -18,12 +18,12 @@
#include <shogun/io/SGIO.h>
#include <shogun/lib/DataType.h>
#include <shogun/lib/ParameterObserverInterface.h>
#include <shogun/lib/RxCppHeader.h>
#include <shogun/lib/ShogunException.h>
#include <shogun/lib/any.h>
#include <shogun/lib/common.h>
#include <shogun/lib/config.h>
#include <shogun/lib/tag.h>
#include <shogun/lib/RxCppHeader.h>

#include <utility>

Expand Down Expand Up @@ -123,10 +123,17 @@ enum EGradientAvailability
class CSGObject
{
public:

typedef rxcpp::subjects::subject<ParameterObserverInterface::ObservedValue> SGSubject;
typedef rxcpp::observable<ParameterObserverInterface::ObservedValue, rxcpp::dynamic_observable<ParameterObserverInterface::ObservedValue>> SGObservable;
typedef rxcpp::subscriber<ParameterObserverInterface::ObservedValue, rxcpp::observer<ParameterObserverInterface::ObservedValue, void, void, void, void>> SGSubscriber;
typedef rxcpp::subjects::subject<ParameterObserverInterface::ObservedValue>
SGSubject;
typedef rxcpp::observable<
ParameterObserverInterface::ObservedValue,
rxcpp::dynamic_observable<ParameterObserverInterface::ObservedValue>>
SGObservable;
typedef rxcpp::subscriber<
ParameterObserverInterface::ObservedValue,
rxcpp::observer<ParameterObserverInterface::ObservedValue, void, void,
void, void>>
SGSubscriber;

/** default constructor */
CSGObject();
Expand Down Expand Up @@ -408,8 +415,7 @@ class CSGObject
* Get parameters observable
* @return RxCpp observable
*/
SGObservable *
get_parameters_observable()
SGObservable* get_parameters_observable()
{
return m_observable_params;
};
Expand Down Expand Up @@ -609,13 +615,13 @@ class CSGObject
RefCount* m_refcount;

/** Subject used to create the params observer */
SGSubject * m_subject_params;
SGSubject* m_subject_params;

/** Parameter Observable */
SGObservable * m_observable_params;
SGObservable* m_observable_params;

/** Subscriber used to call onNext, onComplete etc.*/
SGSubscriber * m_subscriber_params;
SGSubscriber* m_subscriber_params;
};
}
#endif // __SGOBJECT_H__
20 changes: 12 additions & 8 deletions src/shogun/lib/RxCppHeader.h
@@ -1,23 +1,27 @@
#ifndef SHOGUN_RXCPPHEADER_H
#define SHOGUN_RXCPPHEADER_H


/**
* Rx namespace
*/
namespace rxcpp
{
template<class, class, class, class, class> class observer;
template <class, class, class, class, class>
class observer;

namespace subjects
namespace subjects
{
template <class> class subject;
template <class>
class subject;
}

template <class> class dynamic_observable;
template <class, class> class observable;
template <class, class> class subscriber;
class subscription;
template <class>
class dynamic_observable;
template <class, class>
class observable;
template <class, class>
class subscriber;
class subscription;
}

#endif // SHOGUN_RXCPPHEADER_H
23 changes: 12 additions & 11 deletions src/shogun/lib/Signal.cpp
Expand Up @@ -12,19 +12,20 @@
#include <csignal>
#include <stdlib.h>

#include <rxcpp/rx-lite.hpp>
#include <shogun/io/SGIO.h>
#include <shogun/lib/Signal.h>
#include <rxcpp/rx-lite.hpp>

using namespace shogun;
using namespace rxcpp;

bool CSignal::m_active = false;
CSignal::SGSubjectS * CSignal::m_subject =
new rxcpp::subjects::subject<int>();
CSignal::SGSubjectS* CSignal::m_subject = new rxcpp::subjects::subject<int>();

CSignal::SGObservableS * CSignal::m_observable = new CSignal::SGObservableS(CSignal::m_subject->get_observable());
CSignal::SGSubscriberS * CSignal::m_subscriber = new CSignal::SGSubscriberS(CSignal::m_subject->get_subscriber());
CSignal::SGObservableS* CSignal::m_observable =
new CSignal::SGObservableS(CSignal::m_subject->get_observable());
CSignal::SGSubscriberS* CSignal::m_subscriber =
new CSignal::SGSubscriberS(CSignal::m_subject->get_subscriber());

CSignal::CSignal()
{
Expand Down Expand Up @@ -80,11 +81,11 @@ void CSignal::handler(int signal)

void CSignal::reset_handler()
{
delete m_subject;
delete m_observable;
delete m_subscriber;
delete m_subject;
delete m_observable;
delete m_subscriber;

m_subject = new rxcpp::subjects::subject<int>();
m_observable = new CSignal::SGObservableS(m_subject->get_observable());
m_subscriber = new CSignal::SGSubscriberS(m_subject->get_subscriber());
m_subject = new rxcpp::subjects::subject<int>();
m_observable = new CSignal::SGObservableS(m_subject->get_observable());
m_subscriber = new CSignal::SGSubscriberS(m_subject->get_subscriber());
}
19 changes: 11 additions & 8 deletions src/shogun/lib/Signal.h
Expand Up @@ -37,10 +37,12 @@ namespace shogun
class CSignal : CSGObject
{
public:

typedef rxcpp::subjects::subject<int> SGSubjectS;
typedef rxcpp::observable<int, rxcpp::dynamic_observable<int>> SGObservableS;
typedef rxcpp::subscriber<int, rxcpp::observer<int, void, void, void, void>> SGSubscriberS;
typedef rxcpp::observable<int, rxcpp::dynamic_observable<int>>
SGObservableS;
typedef rxcpp::subscriber<int,
rxcpp::observer<int, void, void, void, void>>
SGSubscriberS;

CSignal();
virtual ~CSignal();
Expand All @@ -56,7 +58,7 @@ namespace shogun
* Get observable
* @return RxCpp observable
*/
SGObservableS * get_observable()
SGObservableS* get_observable()
{
return m_observable;
};
Expand All @@ -67,7 +69,7 @@ namespace shogun
* Get subscriber
* @return RxCpp subscriber
*/
SGSubscriberS * get_subscriber()
SGSubscriberS* get_subscriber()
{
return m_subscriber;
};
Expand All @@ -90,11 +92,12 @@ namespace shogun
private:
/** Active signal */
static bool m_active;

public:
/** Observable */
static SGSubjectS * m_subject;
static SGObservableS * m_observable;
static SGSubscriberS * m_subscriber;
static SGSubjectS* m_subject;
static SGObservableS* m_observable;
static SGSubscriberS* m_subscriber;
};
}
#endif // __SIGNAL__H_
2 changes: 1 addition & 1 deletion src/shogun/machine/Machine.cpp
Expand Up @@ -9,10 +9,10 @@
* Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
*/

#include <rxcpp/rx-lite.hpp>
#include <shogun/base/init.h>
#include <shogun/lib/Signal.h>
#include <shogun/machine/Machine.h>
#include <rxcpp/rx-lite.hpp>

using namespace shogun;

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/lib/Signal_unittest.cc
Expand Up @@ -35,8 +35,8 @@
#include <gtest/gtest.h>
#include <shogun/lib/Signal.h>

#include <rxcpp/rx-lite.hpp>
#include <csignal>
#include <rxcpp/rx-lite.hpp>

using namespace shogun;
using namespace rxcpp;
Expand Down

0 comments on commit 4ad2814

Please sign in to comment.