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

Opening c3d from filestream instead of filepath #347

Open
TrevorAshby opened this issue Nov 21, 2024 · 2 comments
Open

Opening c3d from filestream instead of filepath #347

TrevorAshby opened this issue Nov 21, 2024 · 2 comments

Comments

@TrevorAshby
Copy link

TrevorAshby commented Nov 21, 2024

@pariterre Thanks for the great resource that ezc3d is! It's been a huge help in our work. However, we've run into an issue where we are required to load a c3d file from memory that has already been read, meaning that the 2 constructors that exist for the c3d object are insufficient.

Is this feature planned to be added? If we were to go about adding this ourselves, i've identified the following files will need modified:

  • ezc3d.h
  • ezc3d.cpp

What other files would I need to modify to include an additional constructor function overload?
Thanks again!

@pariterre
Copy link
Member

Hi there!
I am not sure that I understand what you try to achieve. Do you mean that you have the equivalent of the ezc3d in the memory and you want to effectively copy it? Or, you mean that you have the actual binary loaded in memory and you want to load it into ezc3d?

If it is the former, I think a simple copy of the ezc3d structure would suffice. For the latter, you would need to add a constructor for the full reading path (including header, parameters and data). This should not be hard at all though as a FILE and a memory access are pretty much the same

@TrevorAshby
Copy link
Author

TrevorAshby commented Nov 21, 2024

Thanks for the quick comment! It is the latter! I have the c3d file loaded as binary in memory, and need to load that into the ezc3d c3d object. I'm fairly new to c3d, and it's been ages since I have done c++, but I think i've gotten close.

Essentially what I will need to do is add a constructor that takes in an fstream and is used in place of the line?

// ezc3d.cpp line 57
std::fstream stream(_filePath, std::ios::in | std::ios::binary);

I should note as well that we are using the python compiled version. My intended use would load the c3d file as a io.Bytes/BufferedReader/Bytes object which will be read into the c3d object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants