Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: add c++ ndtp message structs, packing / unpacking utils, and convenience data structs #1

Merged
merged 27 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9811f5f
refactor: use vcpkg
chu-k Oct 14, 2024
82775be
refactor: Header and Broadband
chu-k Oct 15, 2024
95c71a5
refactor: Spiketrain
chu-k Oct 15, 2024
a53b215
chore: lint
chu-k Oct 15, 2024
0d778eb
wip: test Message pack/unpack
chu-k Oct 15, 2024
6be3ffd
chore: fix message unpacking, tests
antoniaelsen Oct 15, 2024
43fe5c0
chore: update git submodule location...
antoniaelsen Oct 15, 2024
9bd6095
chore: update generated synapse-api proto location
antoniaelsen Oct 15, 2024
89be2f3
chore: update cmake target name
antoniaelsen Oct 15, 2024
d7e8be2
chore: cleanup
antoniaelsen Oct 15, 2024
af7c0f8
fix: missing timestamp in BinnedSpiketrainData
chu-k Oct 15, 2024
21ae7c7
feat: support BE / network byte order packing; spike train bin_size_ms
antoniaelsen Oct 15, 2024
ea4e483
fix: tightly pack channel data (again), fix endianness
antoniaelsen Oct 16, 2024
ae3c46b
chore: lint
antoniaelsen Oct 16, 2024
49f57b0
chore: update sample_rate in Broadband payload to 3 bytes
antoniaelsen Oct 16, 2024
dc0905e
feat: add chunking to electrical broadband data, based on max payload…
antoniaelsen Oct 16, 2024
9efafec
test: better tests
antoniaelsen Oct 16, 2024
f3afd98
chore: add option to ignore crc when unpacking msgs
antoniaelsen Oct 16, 2024
9165979
chore: remove unused, unfinished python bindings
antoniaelsen Oct 21, 2024
c70968b
ci: add build and test ci pipeline
antoniaelsen Oct 21, 2024
de8d40f
fix: define long long hton ntoh for linux
antoniaelsen Oct 22, 2024
09e84be
fix: add include for host/network byte order conversion functions
polymerizedsage Oct 22, 2024
c94bf99
fix: add include for linux hton ntoh utils
antoniaelsen Oct 22, 2024
a2e0b43
ci: cache vcpkg
antoniaelsen Oct 22, 2024
db6e505
chore: cleanup
antoniaelsen Oct 22, 2024
d196280
chore: fix test
antoniaelsen Oct 22, 2024
5e1ce85
chore: add missing includes, fic ElectricalBroadbandData field types
antoniaelsen Oct 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Google C/C++ Code Style settings
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html

Language: Cpp
BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: BlockIndent
AlignConsecutiveAssignments: None
AlignOperands: Align
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Inline
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterStruct: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ColumnLimit: 120
CompactNamespaces: false
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false # Make sure the * or & align on the left
EmptyLineBeforeAccessModifier: LogicalBlock
FixNamespaceComments: true
IncludeBlocks: Preserve
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PointerAlignment: Left
ReflowComments: false
SeparateDefinitionBlocks: Always
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++23
TabWidth: 2
UseTab: Never
20 changes: 20 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Checks: "
cppcoreguidelines-*,
-cppcoreguidelines-avoid-do-while,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-special-member-functions,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
google-*,
modernize-*,
-modernize-use-trailing-return-type,
-modernize-avoid-c-arrays,
-modernize-pass-by-value,
readability-*,
-readability-identifier-length,
-readability-function-cognitive-complexity,
-readability-convert-member-functions-to-static,
-readability-container-contains
"
HeaderFilterRegex: "src/.*"
FormatStyle: google
65 changes: 65 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: main

on:
push:
branches:
- "main"
pull_request:
workflow_dispatch:

env:
_VCPKG_: ${{ github.workspace }}/external/microsoft/vcpkg
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/external/microsoft/vcpkg/bincache
VCPKG_FEATURE_FLAGS: "dependencygraph"

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.GH_TOKEN }}

- uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');

- name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'"
run: mkdir -p ${{ github.workspace }}/external/microsoft/vcpkg/bincache
shell: bash

- uses: lukka/get-cmake@latest
with:
cmakeVersion: "3.29.0"

- name: Restore vcpkg
uses: actions/cache@v3
with:
path: |
${{ env._VCPKG_ }}
!${{ env._VCPKG_ }}/buildtrees
!${{ env._VCPKG_ }}/packages
!${{ env._VCPKG_ }}/downloads
!${{ env._VCPKG_ }}/installed
key: |
ubuntu-latest-${{ hashFiles( '.git/modules/external/microsoft/vcpkg/HEAD' )}}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"

- name: Build
run: |
VCPKG_MANIFEST_FEATURES="tests" make configure
make build

- name: Test
run: |
make test
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Generated protobuf code
synapse/api/
include/science/libndtp/synapse/api/
bin/
proto/*
*_pb2.py
Expand Down
10 changes: 8 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[submodule "synapse-api"]
path = synapse-api
[submodule "external/sciencecorp/synapse-api"]
path = external/sciencecorp/synapse-api
url = [email protected]:sciencecorp/synapse-api.git
[submodule "external/sciencecorp/vcpkg"]
path = external/sciencecorp/vcpkg
url = [email protected]:sciencecorp/vcpkg.git
[submodule "external/microsoft/vcpkg"]
path = external/microsoft/vcpkg
url = [email protected]:microsoft/vcpkg.git
Loading
Loading