ceo 0.1.0

CUDA Engined Optics
Documentation
#ifndef __PLOTLY_H__
#define __PLOTLY_H__

#ifndef __PTHREAD_H__
#include <pthread.h>
#endif

#ifndef __CURL_H__
#include <curl/curl.h>
#endif

#ifndef __UTILITIES_H__
#include "utilities.h"
#endif

#ifndef __JSMN_H__
#include "jsmn.h"
#endif

#include "plotly.credentials"

#define P_LEN 64

struct plotly_properties{
  char filename[P_LEN];
  char type[P_LEN];
  char title[P_LEN];
  char *xData;
  char xtitle[P_LEN];
  char *yData;
  char ytitle[P_LEN];
  char *zData;
  char ztitle[P_LEN];
  char colorscale[P_LEN];
  char name[P_LEN];
  char fileopt[P_LEN];
  float aspect_ratio;
  plotly_properties(void) 
  {
    strcpy(title,"");
    strcpy(xtitle,"");
    strcpy(ytitle,"");
    strcpy(ztitle,"");
    strcpy(colorscale,"Portland");
    strcpy(name,"");
    xData = NULL;
    yData = NULL;
    zData = NULL;
    aspect_ratio = 1.0;
  }

  int set(const char *param, const char *value);
  int set(const char *param, float *value, int N);
  int set(const char *param, float *value, int N, int M);
};
        
void imagesc(plotly_properties *p);
void plot(plotly_properties *p);

struct plotly_resp {  char url[256];
  char message[256];
  char warning[256];
  char filename[256];
  char error[256];
};

int x2json(char *zData, float *zdata, int N);
int y2json(char *zData, float *zdata, int N);
int z2json(char *zData, float *zdata, int N, int M);
void curlplotly(void *json);
size_t write_data(void *ptr, size_t size, size_t count, void *stream);

#endif // __PLOTLY_H__