text stringlengths 1 24.5M |
|---|
//
// Copyright (c) MapBox All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause
//
#ifndef MAPBOX_UTIL_VARIANT_VISITOR_HPP
#define MAPBOX_UTIL_VARIANT_VISITOR_HPP
#include <utility>
namespace mapbox {
namespace util {
template <typename... Fns>
struct visitor;
template <typename Fn>
struct visitor<Fn> : F... |
//
// Copyright (c) 2017 Sean Barrett
// SPDX-License-Identifier: MIT
//
/* stb_image - v2.16 - public domain image loader - http://nothings.org/stb_image.h
no warranty implied; use at your own risk
Do this:
#define STB_IMAGE_IMPLEMENTATION
before you include this file... |
//
// Copyright (c) 2017 Sean Barrett
// SPDX-License-Identifier: MIT
//
/* stb_image_resize - v0.95 - public domain image resizing
by Jorge L Rodriguez (@VinoBS) - 2014
http://github.com/nothings/stb
Written with emphasis on usability, portability, and efficiency. (No
SIMD or threads, so it be easily out... |
//
// Copyright (c) 2017 Sean Barrett
// SPDX-License-Identifier: MIT
//
/* stb_image_write - v1.06 - public domain - http://nothings.org/stb/stb_image_write.h
writes out PNG/BMP/TGA/JPEG/HDR images to C stdio - Sean Barrett 2010-2015
no warranty implied; use at your own risk
... |
//#pragma once
//
//
//#include "armstrong-compiler.h"
//
//
//vector<string> vars;
//vector<string> labels;
//vector<int> labelLineValues;
//vector<string> compiledLines;
//
//
//
//int ConvertAsciiToSdcii(int asciiCode) {
// int conversionTable[600]; // [ascii] = sdcii
// for (size_t i = 0; i < sizeof(conversionT... |
#pragma once
#include <string>
#include <vector>
#include <stdio.h>
#include <iostream>
#include "colorprint.h"
#include <sstream>
#include <cctype>
#include <math.h>
//#include "processing.h"
using namespace std;
string DecToHexFilled(int input, int desiredSize);
string BinToHexFilled(const string& input, int ... |
#include "assembler.h"
|
#pragma once
|
#ifndef _AUDIO_H_
#define _AUDIO_H_
#include <chrono>
#include <array>
#include <cstring>
#include <cmath>
#include <chrono>
#include <thread>
#include <SDL.h>
using namespace std::chrono;
namespace Hyper_BandCHIP
{
enum class EnvelopeGeneratorState { Off, Attack, Decay, Sustain, Release };
class Audio
{
using... |
#ifndef COLOR_HPP
#define COLOR_HPP
#include <algorithm>
#include <iostream>
#include <list>
#include <map>
#include <string>
#include <type_traits>
#include <utility>
#include <windows.h>
namespace hue
{
constexpr int DEFAULT_COLOR = 7;
constexpr int BAD_COLOR = -256;
static const std::map<std::string, ... |
#pragma once
#include <algorithm>
#include <fstream>
#include <iostream>
#include <limits>
#include <regex>
#include <string>
#include "strops.h"
#if defined(__unix__)
#define UNIX true
#define WINDOWS false
#elif defined(_MSC_VER)
#define UNIX false
#define WINDOWS true
#endif
#if WINDOWS
#include "color.hpp... |
#include <windows.h>
#include "escapi.h"
countCaptureDevicesProc countCaptureDevices;
initCaptureProc initCapture;
deinitCaptureProc deinitCapture;
doCaptureProc doCapture;
isCaptureDoneProc isCaptureDone;
getCaptureDeviceNameProc getCaptureDeviceName;
ESCAPIVersionProc ESCAPIVersion;
getCapturePropertyValueProc getCa... |
/* Extremely Simple Capture API */
struct SimpleCapParams
{
/* Target buffer.
* Must be at least mWidth * mHeight * sizeof(int) of size!
*/
int * mTargetBuf;
/* Buffer width */
int mWidth;
/* Buffer height */
int mHeight;
};
enum CAPTURE_PROPETIES
{
CAPTURE_BRIGHTNESS,
CAPTURE_CONTRAST,
CAPTURE_HUE,
C... |

#include <limits.h>
#include <algorithm>
#include <chrono>
#include <string>
#include <vector>
//#include <SDL.h>
//#include <SDL_mixer.h>
#include <time.h>
#include <codecvt>
#include <filesystem>
#include <fstream>
#include <map>
#include <queue>
#include <sstream>
#include "VSSynth/VSSynth.h"
#include "armstr... |
#pragma once
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
static inline std::string trim(std::string s);
static std::vector<std::string> PreProcess(std::string unProcessed);
static std::vector<std::string> split(std::string str, std::string token);
static std::string... |
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Astro8-Emulator.rc
//
#define IDI_ICON1 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_V... |
#include "strops.h"
std::string JoinArrayPieces(std::string input[])
{
std::string outStr = "";
for (int i = 0; i < sizeof(input) / sizeof(input[0]); i++) {
outStr += input[i];
}
return outStr;
}
std::string SplitGetLastAfterChar(const std::string& str, std::string delim)
{
std::vector<std::string> splittedSt... |
#ifndef strops_h
#define strops_h
#include <math.h>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <locale>
#include <sstream>
#include <string>
#include <vector>
#define ERRORMSG(msg) std::cerr << "\n\n[" << __FILE__ << ", at line: " << __LINE__ << "] " << m... |
#pragma once
namespace VSSynth
{
/**
* @brief Collection of sound generators provided with VSSynth
*/
namespace Generators
{
}
/**
* @brief Sound generating device
*
* A sound generator is responsible for creating the sound output which will be eventually sent to the speak... |
#pragma once
#include <SDL.h>
#include <functional>
#include <vector>
#include "SoundGenerator.h"
#include "SynthMiddleware.h"
namespace VSSynth
{
struct SynthData
{
double *time;
double sampleDeltaTime;
std::vector<SoundGenerator *> soundGenerators;
std::vector<SynthMiddlewa... |
#pragma once
namespace VSSynth
{
/**
* @brief Collection of middleware for use with the synthesizer
*/
namespace Middleware
{
}
/**
* @brief Read and modify samples prior to sending them to the speaker
*
* Middleware has the ability to modify any samples prior to sendin... |
#pragma once
#include "SoundGenerator.h"
#include "SynthMiddleware.h"
#include "Synthesizer.h"
#include "generators/Instrument.h"
#include "generators/MonophonicInstrument.h"
#include "generators/PolyphonicInstrument.h"
#include "generators/Sequencer.h"
#include "generators/Tone.h"
#include "middleware/WAVWriter.h"
#in... |
#pragma once
#include <functional>
#include "../utils/Envelope.h"
#include "../SoundGenerator.h"
namespace VSSynth
{
namespace Generators
{
/**
* @brief Device capable of playing multiple notes with an ADSR envelope
*/
class Instrument : public SoundGenerator
{
... |
#pragma once
#include "Instrument.h"
namespace VSSynth
{
namespace Generators
{
/**
* @brief Device capable of playing a single note at a time.
* A monophonic instrument is capable of playing
* only a single note at a time. Real life examples
* include: woodwind, br... |
#pragma once
#include <mutex>
#include <vector>
#include "Instrument.h"
namespace VSSynth
{
namespace Generators
{
/**
* @brief Device capable of playing notes simultaneously
* A polyphonic instrument is capable of playing
* multiple notes simultaneously. Real life examples... |
#pragma once
#include "Instrument.h"
#include <vector>
namespace VSSynth
{
namespace Generators
{
/**
* @brief Note Sequencer for Instruments
*
* A sequencer will queue up notes to be played for the set instrument.
*
*/
class Sequencer : public ... |
#pragma once
#include "../SoundGenerator.h"
#include <functional>
#include <mutex>
#include <vector>
namespace VSSynth
{
namespace Generators
{
/**
* @brief Generates a given tone at multiple frequencies.
*/
class Tone : public SoundGenerator
{
public:
... |
#pragma once
#include "../SynthMiddleware.h"
#include <fstream>
#include <string>
namespace VSSynth
{
namespace Middleware
{
/**
* @brief Outputs Audio Samples to a wave file
*
* WAVWriter will take audio samples and write them into a WAV file.
* In order to acc... |
#pragma once
namespace VSSynth
{
/**
* @brief ADSR envelope data
*
* Represent the ADSR curve with five parameters:
*
* Attack Amplitude
* Sustain Amplitude
* Attack Time
* Decay Time
* Release Time
*
* An optional sixth paramater, sustainable, can also be taken.
... |
#pragma once
namespace VSSynth
{
/**
* @brief Notes and their respective frequencies
*
* Table pulled from https://pages.mtu.edu/~suits/notefreqs.html
* Sharp notes and flat notes contain a lowercase s or b respectively.
*/
namespace Notes
{
const double C0 = 16.35;
... |
#pragma once
#include "Envelope.h"
#include "Waveforms.h"
namespace VSSynth
{
/**
* @brief A collection of different synth patches and their envelopes
*/
namespace Patches
{
/**
* @brief A Patch takes a frequency and time. It outputs a signed value between -1.0 and 1.0
... |
#pragma once
#include <functional>
namespace VSSynth
{
/**
* @brief Collection of waveform primitives
*
* This namespace encompasses many of the common waveforms an
* audio synthesizer would want to use.
*/
namespace Waveforms
{
/**
* @brief Generates a pulse wa... |
// Example project which can be built with SSL enabled or disabled.
// The espressif8266_stage platform must be installed.
// Refer to platformio.ini for the build configuration and platform installation.
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <Ticker.h>
#include <AsyncMqttClient.h>
#define WIFI_SSID... |
#include "AsyncMqttClient.hpp"
AsyncMqttClient::AsyncMqttClient()
: _client()
, _head(nullptr)
, _tail(nullptr)
, _sent(0)
, _state(DISCONNECTED)
, _disconnectReason(AsyncMqttClientDisconnectReason::TCP_DISCONNECTED)
, _lastClientActivity(0)
, _lastServerActivity(0)
, _lastPingRequestTime(0)
, _generatedClientId{0}
, ... |
#ifndef SRC_ASYNCMQTTCLIENT_H_
#define SRC_ASYNCMQTTCLIENT_H_
#include "AsyncMqttClient.hpp"
#endif // SRC_ASYNCMQTTCLIENT_H_
|
#pragma once
#include <functional>
#include <vector>
#include "Arduino.h"
#ifndef MQTT_MIN_FREE_MEMORY
#define MQTT_MIN_FREE_MEMORY 4096
#endif
#ifdef ESP32
#include <AsyncTCP.h>
#include <freertos/semphr.h>
#elif defined(ESP8266)
#include <ESPAsyncTCP.h>
#else
#error Platform not supported
#endif
#if ASYNC_TCP_SS... |
#pragma once
#include <functional>
#include "DisconnectReasons.hpp"
#include "MessageProperties.hpp"
#include "Errors.hpp"
namespace AsyncMqttClientInternals {
// user callbacks
typedef std::function<void(bool sessionPresent)> OnConnectUserCallback;
typedef std::function<void(AsyncMqttClientDisconnectReason reason)>... |
#pragma once
enum class AsyncMqttClientDisconnectReason : uint8_t {
TCP_DISCONNECTED = 0,
MQTT_UNACCEPTABLE_PROTOCOL_VERSION = 1,
MQTT_IDENTIFIER_REJECTED = 2,
MQTT_SERVER_UNAVAILABLE = 3,
MQTT_MALFORMED_CREDENTIALS = 4,
MQTT_NOT_AUTHORIZED = 5,
ESP8266_NOT_ENOUGH_SPACE = 6,
TLS_BAD_FINGERPRINT = 7
... |
#pragma once
enum class AsyncMqttClientError : uint8_t {
MAX_RETRIES = 0,
OUT_OF_MEMORY = 1
};
|
#pragma once
namespace AsyncMqttClientInternals {
constexpr struct {
const uint8_t RESERVED = 0;
const uint8_t CONNECT = 1;
const uint8_t CONNACK = 2;
const uint8_t PUBLISH = 3;
const uint8_t PUBACK = 4;
const uint8_t PUBREC = 5;
const uint8_t PUBREL = 6;
const uint8_t PUB... |
#pragma once
namespace AsyncMqttClientInternals {
class Helpers {
public:
static uint32_t decodeRemainingLength(char* bytes) {
uint32_t multiplier = 1;
uint32_t value = 0;
uint8_t currentByte = 0;
uint8_t encodedByte;
do {
encodedByte = bytes[currentByte++];
value += (encodedByte & 1... |
#pragma once
struct AsyncMqttClientMessageProperties {
uint8_t qos;
bool dup;
bool retain;
};
|
#pragma once
namespace AsyncMqttClientInternals {
enum class BufferState : uint8_t {
NONE = 0,
REMAINING_LENGTH = 2,
VARIABLE_HEADER = 3,
PAYLOAD = 4
};
struct ParsingInformation {
BufferState bufferState;
uint16_t maxTopicLength;
char* topicBuffer;
uint8_t packetType;
uint16_t packetFlags;
uint... |
#pragma once
namespace AsyncMqttClientInternals {
struct PendingPubRel {
uint16_t packetId;
};
struct PendingAck {
uint8_t packetType;
uint8_t headerFlag;
uint16_t packetId;
};
} // namespace AsyncMqttClientInternals
|
#include "ConnAckPacket.hpp"
using AsyncMqttClientInternals::ConnAckPacket;
ConnAckPacket::ConnAckPacket(ParsingInformation* parsingInformation, OnConnAckInternalCallback callback)
: _parsingInformation(parsingInformation)
, _callback(callback)
, _bytePosition(0)
, _sessionPresent(false)
, _connectReturnCode(0) {
}
... |
#pragma once
#include "Arduino.h"
#include "Packet.hpp"
#include "../ParsingInformation.hpp"
#include "../Callbacks.hpp"
namespace AsyncMqttClientInternals {
class ConnAckPacket : public Packet {
public:
explicit ConnAckPacket(ParsingInformation* parsingInformation, OnConnAckInternalCallback callback);
~ConnAckP... |
#pragma once
namespace AsyncMqttClientInternals {
class Packet {
public:
virtual ~Packet() {}
virtual void parseVariableHeader(char* data, size_t len, size_t* currentBytePosition) = 0;
virtual void parsePayload(char* data, size_t len, size_t* currentBytePosition) = 0;
};
} // namespace AsyncMqttClientInternal... |
#include "PingRespPacket.hpp"
using AsyncMqttClientInternals::PingRespPacket;
PingRespPacket::PingRespPacket(ParsingInformation* parsingInformation, OnPingRespInternalCallback callback)
: _parsingInformation(parsingInformation)
, _callback(callback) {
}
PingRespPacket::~PingRespPacket() {
}
void PingRespPacket::par... |
#pragma once
#include "Arduino.h"
#include "Packet.hpp"
#include "../ParsingInformation.hpp"
#include "../Callbacks.hpp"
namespace AsyncMqttClientInternals {
class PingRespPacket : public Packet {
public:
explicit PingRespPacket(ParsingInformation* parsingInformation, OnPingRespInternalCallback callback);
~PingR... |
#include "PubAckPacket.hpp"
using AsyncMqttClientInternals::PubAckPacket;
PubAckPacket::PubAckPacket(ParsingInformation* parsingInformation, OnPubAckInternalCallback callback)
: _parsingInformation(parsingInformation)
, _callback(callback)
, _bytePosition(0)
, _packetIdMsb(0)
, _packetId(0) {
}
PubAckPacket::~PubAck... |
#pragma once
#include "Arduino.h"
#include "Packet.hpp"
#include "../ParsingInformation.hpp"
#include "../Callbacks.hpp"
namespace AsyncMqttClientInternals {
class PubAckPacket : public Packet {
public:
explicit PubAckPacket(ParsingInformation* parsingInformation, OnPubAckInternalCallback callback);
~PubAckPacke... |
#include "PubCompPacket.hpp"
using AsyncMqttClientInternals::PubCompPacket;
PubCompPacket::PubCompPacket(ParsingInformation* parsingInformation, OnPubCompInternalCallback callback)
: _parsingInformation(parsingInformation)
, _callback(callback)
, _bytePosition(0)
, _packetIdMsb(0)
, _packetId(0) {
}
PubCompPacket::~... |
#pragma once
#include "Arduino.h"
#include "Packet.hpp"
#include "../ParsingInformation.hpp"
#include "../Callbacks.hpp"
namespace AsyncMqttClientInternals {
class PubCompPacket : public Packet {
public:
explicit PubCompPacket(ParsingInformation* parsingInformation, OnPubCompInternalCallback callback);
~PubCompP... |
#include "PublishPacket.hpp"
using AsyncMqttClientInternals::PublishPacket;
PublishPacket::PublishPacket(ParsingInformation* parsingInformation, OnMessageInternalCallback dataCallback, OnPublishInternalCallback completeCallback)
: _parsingInformation(parsingInformation)
, _dataCallback(dataCallback)
, _completeCallba... |
#pragma once
#include "Arduino.h"
#include "Packet.hpp"
#include "../Flags.hpp"
#include "../ParsingInformation.hpp"
#include "../Callbacks.hpp"
namespace AsyncMqttClientInternals {
class PublishPacket : public Packet {
public:
explicit PublishPacket(ParsingInformation* parsingInformation, OnMessageInternalCallbac... |
#include "PubRecPacket.hpp"
using AsyncMqttClientInternals::PubRecPacket;
PubRecPacket::PubRecPacket(ParsingInformation* parsingInformation, OnPubRecInternalCallback callback)
: _parsingInformation(parsingInformation)
, _callback(callback)
, _bytePosition(0)
, _packetIdMsb(0)
, _packetId(0) {
}
PubRecPacket::~PubRec... |
#pragma once
#include "Arduino.h"
#include "Packet.hpp"
#include "../ParsingInformation.hpp"
#include "../Callbacks.hpp"
namespace AsyncMqttClientInternals {
class PubRecPacket : public Packet {
public:
explicit PubRecPacket(ParsingInformation* parsingInformation, OnPubRecInternalCallback callback);
~PubRecPacke... |
#include "PubRelPacket.hpp"
using AsyncMqttClientInternals::PubRelPacket;
PubRelPacket::PubRelPacket(ParsingInformation* parsingInformation, OnPubRelInternalCallback callback)
: _parsingInformation(parsingInformation)
, _callback(callback)
, _bytePosition(0)
, _packetIdMsb(0)
, _packetId(0) {
}
PubRelPacket::~PubRel... |
#pragma once
#include "Arduino.h"
#include "Packet.hpp"
#include "../ParsingInformation.hpp"
#include "../Callbacks.hpp"
namespace AsyncMqttClientInternals {
class PubRelPacket : public Packet {
public:
explicit PubRelPacket(ParsingInformation* parsingInformation, OnPubRelInternalCallback callback);
~PubRelPacke... |
#include "SubAckPacket.hpp"
using AsyncMqttClientInternals::SubAckPacket;
SubAckPacket::SubAckPacket(ParsingInformation* parsingInformation, OnSubAckInternalCallback callback)
: _parsingInformation(parsingInformation)
, _callback(callback)
, _bytePosition(0)
, _packetIdMsb(0)
, _packetId(0) {
}
SubAckPacket::~SubAck... |
#pragma once
#include "Arduino.h"
#include "Packet.hpp"
#include "../ParsingInformation.hpp"
#include "../Callbacks.hpp"
namespace AsyncMqttClientInternals {
class SubAckPacket : public Packet {
public:
explicit SubAckPacket(ParsingInformation* parsingInformation, OnSubAckInternalCallback callback);
~SubAckPacke... |
#include "UnsubAckPacket.hpp"
using AsyncMqttClientInternals::UnsubAckPacket;
UnsubAckPacket::UnsubAckPacket(ParsingInformation* parsingInformation, OnUnsubAckInternalCallback callback)
: _parsingInformation(parsingInformation)
, _callback(callback)
, _bytePosition(0)
, _packetIdMsb(0)
, _packetId(0) {
}
UnsubAckPac... |
#pragma once
#include "Arduino.h"
#include "Packet.hpp"
#include "../ParsingInformation.hpp"
#include "../Callbacks.hpp"
namespace AsyncMqttClientInternals {
class UnsubAckPacket : public Packet {
public:
explicit UnsubAckPacket(ParsingInformation* parsingInformation, OnUnsubAckInternalCallback callback);
~Unsub... |
#include "Connect.hpp"
using AsyncMqttClientInternals::ConnectOutPacket;
ConnectOutPacket::ConnectOutPacket(bool cleanSession,
const char* username,
const char* password,
const char* willTopic,
... |
#pragma once
#include <vector>
#include <cstring> // strlen
#include "OutPacket.hpp"
#include "../../Flags.hpp"
#include "../../Helpers.hpp"
namespace AsyncMqttClientInternals {
class ConnectOutPacket : public OutPacket {
public:
ConnectOutPacket(bool cleanSession,
const char* username,
... |
#include "Disconn.hpp"
using AsyncMqttClientInternals::DisconnOutPacket;
DisconnOutPacket::DisconnOutPacket() {
_data[0] = AsyncMqttClientInternals::PacketType.DISCONNECT;
_data[0] = _data[0] << 4;
_data[0] = _data[0] | AsyncMqttClientInternals::HeaderFlag.DISCONNECT_RESERVED;
_data[1] = 0;
}
const uint8_t* ... |
#pragma once
#include "OutPacket.hpp"
#include "../../Flags.hpp"
#include "../../Helpers.hpp"
namespace AsyncMqttClientInternals {
class DisconnOutPacket : public OutPacket {
public:
DisconnOutPacket();
const uint8_t* data(size_t index = 0) const;
size_t size() const;
private:
uint8_t _data[2];
};
} // na... |
#include "OutPacket.hpp"
using AsyncMqttClientInternals::OutPacket;
OutPacket::OutPacket()
: next(nullptr)
, timeout(0)
, noTries(0)
, _released(true)
, _packetId(0) {}
OutPacket::~OutPacket() {}
bool OutPacket::released() const {
return _released;
}
uint8_t OutPacket::packetType() const {
return data(0)[0] >>... |
#pragma once
#include <stdint.h> // uint*_t
#include <stddef.h> // size_t
#include <algorithm> // std::min
#include "../../Flags.hpp"
namespace AsyncMqttClientInternals {
class OutPacket {
public:
OutPacket();
virtual ~OutPacket();
virtual const uint8_t* data(size_t index = 0) const = 0;
virtual size_t s... |
#include "PingReq.hpp"
using AsyncMqttClientInternals::PingReqOutPacket;
PingReqOutPacket::PingReqOutPacket() {
_data[0] = AsyncMqttClientInternals::PacketType.PINGREQ;
_data[0] = _data[0] << 4;
_data[0] = _data[0] | AsyncMqttClientInternals::HeaderFlag.PINGREQ_RESERVED;
_data[1] = 0;
}
const uint8_t* PingRe... |
#pragma once
#include "OutPacket.hpp"
#include "../../Flags.hpp"
#include "../../Helpers.hpp"
namespace AsyncMqttClientInternals {
class PingReqOutPacket : public OutPacket {
public:
PingReqOutPacket();
const uint8_t* data(size_t index = 0) const;
size_t size() const;
private:
uint8_t _data[2];
};
} // na... |
#include "PubAck.hpp"
using AsyncMqttClientInternals::PubAckOutPacket;
PubAckOutPacket::PubAckOutPacket(PendingAck pendingAck) {
_data[0] = pendingAck.packetType;
_data[0] = _data[0] << 4;
_data[0] = _data[0] | pendingAck.headerFlag;
_data[1] = 2;
_packetId = pendingAck.packetId;
_data[2] = pendingAck.pac... |
#pragma once
#include "OutPacket.hpp"
#include "../../Flags.hpp"
#include "../../Helpers.hpp"
#include "../../Storage.hpp"
namespace AsyncMqttClientInternals {
class PubAckOutPacket : public OutPacket {
public:
explicit PubAckOutPacket(PendingAck pendingAck);
const uint8_t* data(size_t index = 0) const;
size_t... |
#include "Publish.hpp"
using AsyncMqttClientInternals::PublishOutPacket;
PublishOutPacket::PublishOutPacket(const char* topic, uint8_t qos, bool retain, const char* payload, size_t length) {
char fixedHeader[5];
fixedHeader[0] = AsyncMqttClientInternals::PacketType.PUBLISH;
fixedHeader[0] = fixedHeader[0] << 4;... |
#pragma once
#include <cstring> // strlen
#include <vector>
#include "OutPacket.hpp"
#include "../../Flags.hpp"
#include "../../Helpers.hpp"
#include "../../Storage.hpp"
namespace AsyncMqttClientInternals {
class PublishOutPacket : public OutPacket {
public:
PublishOutPacket(const char* topic, uint8_t qos, bool ... |
#include "Subscribe.hpp"
using AsyncMqttClientInternals::SubscribeOutPacket;
SubscribeOutPacket::SubscribeOutPacket(const char* topic, uint8_t qos) {
char fixedHeader[5];
fixedHeader[0] = AsyncMqttClientInternals::PacketType.SUBSCRIBE;
fixedHeader[0] = fixedHeader[0] << 4;
fixedHeader[0] = fixedHeader[0] | As... |
#pragma once
#include <cstring> // strlen
#include <vector>
#include "OutPacket.hpp"
#include "../../Flags.hpp"
#include "../../Helpers.hpp"
#include "../../Storage.hpp"
namespace AsyncMqttClientInternals {
class SubscribeOutPacket : public OutPacket {
public:
SubscribeOutPacket(const char* topic, uint8_t qos);
... |
#include "Unsubscribe.hpp"
using AsyncMqttClientInternals::UnsubscribeOutPacket;
UnsubscribeOutPacket::UnsubscribeOutPacket(const char* topic) {
char fixedHeader[5];
fixedHeader[0] = AsyncMqttClientInternals::PacketType.UNSUBSCRIBE;
fixedHeader[0] = fixedHeader[0] << 4;
fixedHeader[0] = fixedHeader[0] | Async... |
#pragma once
#include <cstring> // strlen
#include <vector>
#include "OutPacket.hpp"
#include "../../Flags.hpp"
#include "../../Helpers.hpp"
#include "../../Storage.hpp"
namespace AsyncMqttClientInternals {
class UnsubscribeOutPacket : public OutPacket {
public:
explicit UnsubscribeOutPacket(const char* topic);
... |
//
// Created by netcan on 2021/09/07.
//
#ifndef ASYNCIO_ASYNCIO_NS_H
#define ASYNCIO_ASYNCIO_NS_H
#define ASYNCIO_NS asyncio
#define ASYNCIO_NS_BEGIN namespace ASYNCIO_NS {
#define ASYNCIO_NS_END }
#endif // ASYNCIO_ASYNCIO_NS_H
|
//
// Created by netcan on 2021/11/25.
//
#ifndef ASYNCIO_CALLSTACK_H
#define ASYNCIO_CALLSTACK_H
#include <asyncio/asyncio_ns.h>
#include <asyncio/noncopyable.h>
#include <chrono>
ASYNCIO_NS_BEGIN
namespace detail {
struct CallStackAwaiter {
constexpr bool await_ready() noexcept { return false; }
constexpr vo... |
//
// Created by netcan on 2021/09/07.
//
#ifndef ASYNCIO_EVENT_LOOP_H
#define ASYNCIO_EVENT_LOOP_H
#define FMT_HEADER_ONLY
#include <fmt/core.h>
#include <fmt/format.h>
#include <asyncio/handle.h>
#include <asyncio/noncopyable.h>
#include <asyncio/concept/future.h>
#include <asyncio/selector/selector.h>
#include <util... |
//
// Created by netcan on 2021/11/21.
//
#ifndef ASYNCIO_EXCEPTION_H
#define ASYNCIO_EXCEPTION_H
#include <asyncio/asyncio_ns.h>
#include <exception>
ASYNCIO_NS_BEGIN
struct TimeoutError: std::exception {
[[nodiscard]] const char* what() const noexcept override {
return "TimeoutError";
}
};
struct No... |
//
// Created by xiaozhuai on 2023/3/6.
//
//
// Copyright (c) 2023 xiaozhuai
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the right... |
//
// Created by netcan on 2021/11/20.
//
#ifndef ASYNCIO_GATHER_H
#define ASYNCIO_GATHER_H
#include <asyncio/asyncio_ns.h>
#include <asyncio/task.h>
#include <asyncio/void_value.h>
#include <asyncio/noncopyable.h>
#include <asyncio/concept/awaitable.h>
#include <stdexcept>
#include <tuple>
#include <variant>
ASYNCIO_... |
//
// Created by netcan on 2021/09/08.
//
#ifndef ASYNCIO_HANDLE_H
#define ASYNCIO_HANDLE_H
#include <asyncio/asyncio_ns.h>
#include <cstdint>
#include <source_location>
#include <fmt/core.h>
ASYNCIO_NS_BEGIN
// for cancelled
using HandleId = uint64_t;
struct Handle { // type erase for EventLoop
enum State: uint... |
//
// Created by netcan on 2021/09/08.
//
#ifndef ASYNCIO_NONCOPYABLE_H
#define ASYNCIO_NONCOPYABLE_H
#include <asyncio/asyncio_ns.h>
ASYNCIO_NS_BEGIN
struct NonCopyable {
protected:
NonCopyable() = default;
~NonCopyable() = default;
NonCopyable(NonCopyable&&) = default;
NonCopyable& operator=(NonCopy... |
//
// Created by netcan on 2021/11/29.
//
#ifndef ASYNCIO_OPEN_CONNECTION_H
#define ASYNCIO_OPEN_CONNECTION_H
#include <asyncio/asyncio_ns.h>
#include <asyncio/stream.h>
#include <asyncio/finally.h>
#include <asyncio/selector/event.h>
#include <exception>
#include <asyncio/task.h>
#include <fcntl.h>
#include <sys/type... |
//
// Created by netcan on 2021/11/24.
//
#ifndef ASYNCIO_RESULT_H
#define ASYNCIO_RESULT_H
#include <asyncio/asyncio_ns.h>
#include <asyncio/exception.h>
#include <variant>
#include <optional>
ASYNCIO_NS_BEGIN
template<typename T>
struct Result {
constexpr bool has_value() const noexcept {
return std::ge... |
//
// Created by netcan on 2021/09/07.
//
#ifndef ASYNCIO_RUNNER_H
#define ASYNCIO_RUNNER_H
#include <asyncio/concept/future.h>
#include <asyncio/event_loop.h>
#include <asyncio/schedule_task.h>
ASYNCIO_NS_BEGIN
template<concepts::Future Fut>
decltype(auto) run(Fut&& main) {
auto t = schedule_task(std::forward<Fu... |
//
// Created by netcan on 2021/11/21.
//
#ifndef ASYNCIO_SCHEDULE_TASK_H
#define ASYNCIO_SCHEDULE_TASK_H
#include <asyncio/asyncio_ns.h>
#include <asyncio/noncopyable.h>
#include <asyncio/concept/future.h>
ASYNCIO_NS_BEGIN
template<concepts::Future Task>
struct ScheduledTask: private NonCopyable {
template<conce... |
//
// Created by netcan on 2021/11/21.
//
#ifndef ASYNCIO_SLEEP_H
#define ASYNCIO_SLEEP_H
#include <asyncio/asyncio_ns.h>
#include <asyncio/task.h>
#include <asyncio/noncopyable.h>
#include <chrono>
ASYNCIO_NS_BEGIN
namespace detail {
template<typename Duration>
struct SleepAwaiter: private NonCopyable {
explicit ... |
//
// Created by netcan on 2021/11/30.
//
#ifndef ASYNCIO_START_SERVER_H
#define ASYNCIO_START_SERVER_H
#include "fmt/core.h"
#include <asyncio/asyncio_ns.h>
#include <asyncio/stream.h>
#include <asyncio/finally.h>
#include <asyncio/schedule_task.h>
#include <list>
#include <sys/types.h>
ASYNCIO_NS_BEGIN
namespace co... |
//
// Created by netcan on 2021/11/30.
//
#ifndef ASYNCIO_STREAM_H
#define ASYNCIO_STREAM_H
#include <asyncio/asyncio_ns.h>
#include <asyncio/event_loop.h>
#include <asyncio/selector/event.h>
#include <asyncio/noncopyable.h>
#include <asyncio/task.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <unistd.h>
#... |
//
// Created by netcan on 2021/09/06.
//
#ifndef ASYNCIO_TASK_H
#define ASYNCIO_TASK_H
#include <asyncio/handle.h>
#include <asyncio/event_loop.h>
#include <asyncio/result.h>
#include <asyncio/concept/promise.h>
#include <coroutine>
#include <cassert>
#include <variant>
#include <memory>
ASYNCIO_NS_BEGIN
struct NoWa... |
//
// Created by netcan on 2021/11/20.
//
#ifndef ASYNCIO_VOID_VALUE_H
#define ASYNCIO_VOID_VALUE_H
#include <asyncio/asyncio_ns.h>
ASYNCIO_NS_BEGIN
struct VoidValue { };
namespace detail {
template<typename T>
struct GetTypeIfVoid: std::type_identity<T> {};
template<>
struct GetTypeIfVoid<void>: std::type_identity<V... |
//
// Created by netcan on 2021/11/21.
//
#ifndef ASYNCIO_WAIT_FOR_H
#define ASYNCIO_WAIT_FOR_H
#include <asyncio/asyncio_ns.h>
#include <asyncio/concept/future.h>
#include <asyncio/concept/awaitable.h>
#include <asyncio/event_loop.h>
#include <asyncio/exception.h>
#include <asyncio/schedule_task.h>
#include <asyncio/... |
//
// Created by netcan on 2021/11/22.
//
#ifndef ASYNCIO_AWAITABLE_H
#define ASYNCIO_AWAITABLE_H
#include <asyncio/asyncio_ns.h>
#include <coroutine>
#include <utility>
ASYNCIO_NS_BEGIN
namespace detail {
template<typename A>
struct GetAwaiter: std::type_identity<A> { };
template<typename A>
requires requires(A&& a)... |
//
// Created by netcan on 2021/09/08.
//
#ifndef ASYNCIO_FUTURE_H
#define ASYNCIO_FUTURE_H
#include <asyncio/handle.h>
#include <asyncio/concept/awaitable.h>
#include <concepts>
ASYNCIO_NS_BEGIN
namespace concepts {
template<typename Fut>
concept Future = Awaitable<Fut> && requires(Fut fut) {
requires !std::defa... |
//
// Created by netcan on 2021/12/13.
//
#ifndef ASYNCIO_PROMISE_H
#include <asyncio/asyncio_ns.h>
#include <asyncio/concept/awaitable.h>
#include <asyncio/concept/future.h>
ASYNCIO_NS_BEGIN
namespace concepts {
template<typename P>
concept Promise = requires (P p) {
{ p.get_return_object() } -> Future;
{ p.in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.