Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
codemercenary committed May 20, 2015
2 parents 9cc8722 + f765c72 commit ad6062d
Show file tree
Hide file tree
Showing 75 changed files with 1,143 additions and 675 deletions.
13 changes: 1 addition & 12 deletions .travis.yml
Expand Up @@ -54,18 +54,7 @@ before_script:

script:
# Build Autowriring, run unit tests, and install
- make -j 8 || make
- ctest --output-on-failure
- sudo make install

# Package
- sudo cpack || (cat _CPack_Packages/Linux/TGZ/InstallOutput.log; exit 1)

# Build examples from installed Autowiring
- cd examples
&& cmake . -Dautowiring_ARCHITECTURE=x64
&& make
&& cd ..
- ./scripts/build_test_install.sh

after_failure:
- cat Testing/Temporary/LastTest.log 2> /dev/null
2 changes: 1 addition & 1 deletion Doxyfile
Expand Up @@ -32,7 +32,7 @@ PROJECT_NAME = Autowiring
# This could be handy for archiving the generated documentation or
# if some version control system is used.

PROJECT_NUMBER = "0.5.2"
PROJECT_NUMBER = "0.5.3"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer
Expand Down
14 changes: 2 additions & 12 deletions autowiring/AnySharedPointer.h
Expand Up @@ -50,19 +50,9 @@ struct AnySharedPointer {
return *slot() == rhs;
}

/// <summary>
/// Default for std library sorting of unique elements
/// </summary>
// Additional operator overloads:
bool operator<(const AnySharedPointer& rhs) const { return *slot() < *rhs.slot();}

/// <summary>
/// Default for std library sorting of repeatable elements
/// </summary>
bool operator<=(const AnySharedPointer& rhs) const { return *slot() <= *rhs.slot();}

bool operator>(const AnySharedPointer& rhs) const { return *slot() > *rhs.slot();}

bool operator>=(const AnySharedPointer& rhs) const { return *slot() >= *rhs.slot();}
bool operator!=(const AnySharedPointer& rhs) const { return !(*this == rhs); }

/// <summary>
/// Copy assignment operator
Expand Down
34 changes: 10 additions & 24 deletions autowiring/AutoFilterDescriptor.h
Expand Up @@ -17,16 +17,7 @@ class Deferred;
/// The unbound part of an AutoFilter, includes everything except the AnySharedPointer representing the filter proper
/// </summary>
struct AutoFilterDescriptorStub {
AutoFilterDescriptorStub(void) :
m_pType(nullptr),
m_altitude(autowiring::altitude::Standard),
m_pArgs(nullptr),
m_deferred(false),
m_arity(0),
m_requiredCount(0),
m_pCall(nullptr)
{}

AutoFilterDescriptorStub(void) = default;
AutoFilterDescriptorStub(const AutoFilterDescriptorStub&) = default;
AutoFilterDescriptorStub& operator=(const AutoFilterDescriptorStub&) = default;

Expand Down Expand Up @@ -62,34 +53,34 @@ struct AutoFilterDescriptorStub {

protected:
// Type of the subscriber itself
const std::type_info* m_pType;
const std::type_info* m_pType = nullptr;

// Altitude--controls when the filter gets called
autowiring::altitude m_altitude;
autowiring::altitude m_altitude = autowiring::altitude::Standard;

// This subscriber's argument types
// NOTE: This is a reference to a static generated list,
// therefore it MUST be const and MUST be shallow-copied.
const AutoFilterDescriptorInput* m_pArgs;
const AutoFilterDescriptorInput* m_pArgs = nullptr;

// Set if this is a deferred subscriber. Deferred subscribers cannot receive immediate-style
// decorations, and have additional handling considerations when dealing with non-copyable
// decorations.
bool m_deferred;
bool m_deferred = false;

// The number of parameters that will be extracted from the repository object when making
// a Call. This is used to prime the AutoPacket in order to make saturation checking work
// correctly.
size_t m_arity;
size_t m_arity = 0;

// The number of arguments declared to be required:
size_t m_requiredCount;
size_t m_requiredCount = 0;

// The first argument of this static global is void*, but it is expected that the argument
// that will actually be passed is of a type corresponding to the member function bound
// by this operation. Strong guarantees must be made that the types passed into this routine
// are identical to the types expected by the corresponding call.
t_extractedCall m_pCall;
t_extractedCall m_pCall = nullptr;

public:
// Accessor methods:
Expand Down Expand Up @@ -274,21 +265,16 @@ struct AutoFilterDescriptor:
/// Default for std library sorting of unique elements
/// </summary>
bool operator<(const AutoFilterDescriptor& rhs) const {
// This filter is "logically prior" to the right-hand side if this filter has a HIGHER altitude
// than the one on the right-hand side
return
std::tie(m_altitude, m_pCall, m_autoFilter) <
std::tie(rhs.m_altitude, rhs.m_pCall, rhs.m_autoFilter);
}

/// <summary>
/// Default for std library sorting of repeatable elements
/// </summary>
// Operator overloads:
bool operator<=(const AutoFilterDescriptor& rhs) const { return *this < rhs || *this == rhs;}

bool operator>(const AutoFilterDescriptor& rhs) const { return !(*this <= rhs);}

bool operator>=(const AutoFilterDescriptor& rhs) const { return !(*this < rhs);}
bool operator!=(const AutoFilterDescriptor& rhs) const { return !(*this == rhs); }
};

/// <summary>
Expand Down
21 changes: 7 additions & 14 deletions autowiring/AutoFilterDescriptorInput.h
Expand Up @@ -7,14 +7,7 @@
/// AutoFilter argument disposition
/// </summary>
struct AutoFilterDescriptorInput {
AutoFilterDescriptorInput(void) :
is_input(false),
is_output(false),
is_shared(false),
is_multi(false),
ti(nullptr),
tshift(0)
{}
AutoFilterDescriptorInput(void) = default;

AutoFilterDescriptorInput(
bool is_input,
Expand All @@ -32,12 +25,12 @@ struct AutoFilterDescriptorInput {
tshift(tshift)
{}

const bool is_input;
const bool is_output;
const bool is_shared;
const bool is_multi;
const std::type_info* const ti;
const int tshift;
const bool is_input = false;
const bool is_output = false;
const bool is_shared = false;
const bool is_multi = false;
const std::type_info* const ti = nullptr;
const int tshift = 0;

operator bool(void) const {
return !!ti;
Expand Down
9 changes: 4 additions & 5 deletions autowiring/AutoPacket.h
Expand Up @@ -65,7 +65,7 @@ class AutoPacket:
const std::shared_ptr<void> m_outstanding;

// Pointer to a forward linked list of saturation counters, constructed when the packet is created
SatCounter* m_firstCounter;
SatCounter* m_firstCounter = nullptr;

// The set of decorations currently attached to this object, and the associated lock:
// Decorations are indexed first by type and second by pipe terminating type, if any.
Expand Down Expand Up @@ -115,8 +115,7 @@ class AutoPacket:
/// </summary>
/// <remarks>
/// A satisfaction pulse will call any AutoFilter instances which are satisfied by the
/// decoration of the passed decoration types. Such filters will be called even if
/// some optional inputs remain outstanding.
/// decoration of the passed decoration types.
/// </remarks>
void PulseSatisfaction(DecorationDisposition* pTypeSubs[], size_t nInfos);

Expand Down Expand Up @@ -353,8 +352,8 @@ class AutoPacket:
/// Marks the named decoration as unsatisfiable
/// </summary>
/// <remarks>
/// Marking a decoration as unsatisfiable immediately causes any filters with an optional
/// input on this type to be called, if the remainder of their inputs are available.
/// Marking a decoration as unsatisfiable immediately causes any filters with an input of the
/// form std::shared_ptr<const T> to be called, if the remainder of their inputs are available.
/// </remarks>
template<class T>
void Unsatisfiable(void) {
Expand Down
6 changes: 3 additions & 3 deletions autowiring/AutoPacketFactory.h
Expand Up @@ -45,9 +45,9 @@ class AutoPacketFactory:
t_autoFilterSet m_autoFilters;

// Accumulators used to compute statistics about AutoPacket lifespan.
long long m_packetCount;
double m_packetDurationSum;
double m_packetDurationSqSum;
long long m_packetCount = 0;
double m_packetDurationSum = 0.0;
double m_packetDurationSqSum = 0.0;

// Returns the internal outstanding count, for use with AutoPacket
std::shared_ptr<void> GetInternalOutstanding(void);
Expand Down
6 changes: 3 additions & 3 deletions autowiring/AutoPacketProfiler.h
Expand Up @@ -10,11 +10,11 @@
class AutoPacketProfiler
{
public:
AutoPacketProfiler();
~AutoPacketProfiler();
AutoPacketProfiler(void);
~AutoPacketProfiler(void);

private:
bool m_shouldProfile;
bool m_shouldProfile = false;

/// <summary>
/// Total amount of time spent in any one subscriber
Expand Down
12 changes: 3 additions & 9 deletions autowiring/AutoRestarter.h
Expand Up @@ -6,24 +6,18 @@

struct AutoRestarterConfig
{
AutoRestarterConfig(void) :
restartOnException(false),
restartOnShutdown(false),
startWhenCreated(false)
{}

// Restart the context on exception
bool restartOnException;
bool restartOnException = false;

// Restart the context if it terminates through ordinary behavior. This will continue
// until the AutoRestarter's own exterior context has been terminated.
//
// If the context is manually shut down, it then the AutoRestarter will return nullptr
// in response to GetContext until Regenerate is called
bool restartOnShutdown;
bool restartOnShutdown = false;

// Once the context is created (or recreated), start it up
bool startWhenCreated;
bool startWhenCreated = false;
};

/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions autowiring/BasicThread.h
Expand Up @@ -77,19 +77,19 @@ class BasicThread:
const std::shared_ptr<BasicThreadStateBlock> m_state;

// Flag indicating that this thread was started at some point
bool m_wasStarted;
bool m_wasStarted = false;

// Flag indicating that we need to stop right now
bool m_stop;
bool m_stop = false;

// Run condition:
bool m_running;
bool m_running = false;

// Legacy field, some clients still refer to this
bool& DEPRECATED_MEMBER(m_completed, "Use IsCompleted instead");

// The current thread priority
ThreadPriority m_priority;
ThreadPriority m_priority = ThreadPriority::Default;

/// <summary>
/// Assigns a name to the thread, displayed in debuggers.
Expand Down
2 changes: 1 addition & 1 deletion autowiring/BasicThreadStateBlock.h
Expand Up @@ -18,5 +18,5 @@ struct BasicThreadStateBlock:
std::thread m_thisThread;

// Completion condition, true when this thread is no longer running and has run at least once
bool m_completed;
bool m_completed = false;
};
43 changes: 23 additions & 20 deletions autowiring/C++11/chrono_with_profiling_clock.h
Expand Up @@ -2,53 +2,56 @@
#pragma once

#if STL11_ALLOWED
#include <chrono>
#include <chrono>
#else
#include <autowiring/C++11/boost_chrono.h>
#include <autowiring/C++11/boost_chrono.h>
#endif

//This solution taken from http://stackoverflow.com/questions/8386128/how-to-get-the-precision-of-high-resolution-clock
//Hopefully it will be able to be depricated when VS2015 hits.
// This solution taken from http://stackoverflow.com/questions/8386128/how-to-get-the-precision-of-high-resolution-clock
// Hopefully it will be able to be depricated when VS2015 hits.

#if defined(_MSC_VER) && _MSC_VER < 1900 //high_resolution_clock is broken on all MSVC versions below 2015.
// high_resolution_clock is broken on all MSVC versions below 2015.
#if defined(_MSC_VER) && _MSC_VER < 1900
union _LARGE_INTEGER;
typedef _LARGE_INTEGER LARGE_INTEGER;

extern "C" {
__declspec(dllimport)
int
__stdcall
QueryPerformanceCounter(LARGE_INTEGER * lpPerformanceCount);
int __stdcall QueryPerformanceCounter(LARGE_INTEGER * lpPerformanceCount);

__declspec(dllimport)
int
__stdcall
QueryPerformanceFrequency(LARGE_INTEGER * lpFrequency);
int __stdcall QueryPerformanceFrequency(LARGE_INTEGER * lpFrequency);
}

namespace {
const double g_nanosecs_per_tic = []()
{
const double g_nanosecs_per_tic = [] {
int64_t frequency;
QueryPerformanceFrequency(&reinterpret_cast<LARGE_INTEGER&>(frequency));
return 1e9 / static_cast<double>(frequency);
}();
}

namespace std {
namespace chrono{
namespace chrono {
struct profiling_clock
{
typedef long long rep;
typedef nano period;
typedef duration<rep, period> duration;
typedef time_point<profiling_clock> time_point;
typedef long long rep;
typedef nano period;
typedef duration<rep, period> duration;
typedef time_point<profiling_clock> time_point;
static const bool is_steady = true;

static time_point now() {
static time_point now(void) {
int64_t count;
QueryPerformanceCounter(&reinterpret_cast<LARGE_INTEGER&>(count));
return time_point(duration(static_cast<int64_t>(static_cast<double>(count) * g_nanosecs_per_tic)));

// A cast to double is necessary, here, due to the fact that a potentially very large number
// is being multiplied by a very small number.
return time_point{
duration{
static_cast<int64_t>(static_cast<double>(count) * g_nanosecs_per_tic)
}
};
}
};
}
Expand Down

0 comments on commit ad6062d

Please sign in to comment.