Giter Club home page Giter Club logo

boost-connection-manager's Introduction

boost-connection-manager

A tool to help manage related boost connections.

In short in my projects I find that multiple signals are related to one area of connectivity. I tend to connect/disconnect those signals in groups. The two straight forward approaches are this.

Class 1:
  Signal1

Class 2:
  Function2
  Connection2

  Function3
  Connection3

####OPTION 1: I could use function identifiers to connec/disconnect

Signal1.connect(Function2)
Signal1.connect(Function3)

and then to disconnect using

Signal1.disconnect(Function2)
Signal1.disconnect(Function3)

#####CONS: This doesn't work if I connect lambda functions and it doesn't explicitly disconnect my Functions when objects are destroyed.

####OPTION 2: I use a vector of connections

vector<Connection> mConns;
mConns.push_back( Signal1.connect(Function2) )
mConns.push_back( Signal1.connect(Function3) )

then in the disconnect/deconstructor for(auto& conn : mConns) { conn.disconnect(); }

#####CONS: Repetative, but this is more or less the structure I'll be using in my connection manager

###boost-connection-manager

Class that does something like this

BoostConnectionManager bcm;
bcm.conected() // bool tells us if we have connected signals
bcm.disconnect() // disconnects and releases all connections
bcm = Signal1.connect(Function2) // releases any existing connections and saves the new connection
bcm += Signal1.connect(Function3) // adds this new connection to the list of connections
~bcm // deconstructor will auto disconnect all signals

boost-connection-manager's People

Contributors

lucasvickers avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.