repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
Bern2539/PSoC-AMT21-Driver
src/amt21_driver.c
/******************************************************************************* * * CUI AMT21XX-V Encoder driver for PSoC * Copyright (C) 2020, <NAME> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redi...
Bern2539/PSoC-AMT21-Driver
src/amt21_driver.h
<reponame>Bern2539/PSoC-AMT21-Driver /******************************************************************************* * * CUI AMT21XX-V Encoder driver for PSoC * Copyright (C) 2020, <NAME> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the follow...
oligval/Darkest-Light
Mystic-Light-API-Wrapper/mlapi_wrapper.h
#pragma once #include <tuple> #include <vector> #include <string> namespace starl1ght { namespace mystic_light { enum class result { ok, generic_error, timeout, not_implemented, not_initialized, invalid_argument, device_not_found, not_supported, admin_rights_are_needed, not_in_enum ...
dan-seol/C
strInv.c
<reponame>dan-seol/C #include <stdio.h> int main(int argc, char *argv[]){ char s[100] = "Hello World"; int c = 0; int e = 0; char t[100]; fgets(t, 99, stdin); while(s[c]!= '\0'){ c++; } while(t[e]!= '\0'){ e++; } for(int d = c-1; d >= 0; d--){ printf("%c", s[d]); } prin...
dan-seol/C
garb.c
#include <stdio.h> int main(int argc, char *argv[]){ int i =5; float f = 3.9; int k = i+f; printf("The result of adding 5 and 3.9 is %d\n", k); }
dan-seol/C
midtermEx1.c
#include <stdio.h> void muddle(char string[]){ string[0] = 'M' + 1; string[1] = string[1]; string[2] = string[1]; char temp = string[4]; string[4] = string[5]; string[5] = temp; } int main(void){ char string[10] = "goedel"; muddle(string); printf("%s\n", string); return 0; }
dan-seol/C
countWords.c
#include <stdio.h> #include <string.h> int words(const char sentence[]) { int counted = 0; // result // state: const char* it = sentence; int inword = 0; do switch(*it) { case '\0': case ' ': case '\t': case '\n': case '\r': // TODO others? if (inword){inword = 0; counted++;} break; ...
dan-seol/C
fnvar.c
#include <stdio.h> int increment(int fnvar){ fnvar++; return fnvar; } int main(){ int a=5; increment(a); printf("The value of a is now %d\n", a); int b=5; b = increment(b); printf("The value of b is now %d\n", b); }
dan-seol/C
Ex1617.c
#include <stdio.h> /* copy I to O; 1st version */ int main(void) { printf("We will see the value of boolean values : %d\n", getchar() != EOF); printf("This is the value of EOF, %d\n", EOF); }
dan-seol/C
strCatTest.c
#include <stdio.h> #include <string.h> //Concatenates two strings int main(int argc, char* argv[]){ if(argc != 3){ printf("ERROR: please type in a string and a positive integer\n"); return 0; } char s1[256]; char s2[256]; strcpy(s1, argv[1]); strcpy(s2, argv[2]); strcat(s1, " "); strcat(s1, s2); puts(s1)...
dan-seol/C
StrCountPtr.c
<filename>StrCountPtr.c #include <stdio.h> int main(void){ char str_var[100] = "world"; int length = 0; char *ptr = str_var; while(*ptr){ ptr++; length++; } printf("The string %s has length %d.\n", str_var, length); return 0; }
dan-seol/C
A3_solution.c
/* FILE: A3_solutions.c is where you will code your answers for Assignment 3. * * Each of the functions below can be considered a start for you. They have * the correct specification and are set up correctly with the header file to * be run by the tester programs. * * You should leave all of the code as is, espec...
dan-seol/C
access_arg.c
<reponame>dan-seol/C #include <stdio.h> int main(int argc, char *argv[]){ printf("I have %d arguments\n", argc); printf("The zeroth arg is %s\n", argv[0]); for(int i = 1; i <3 ; i++){ //printf("The 1st arg is %s", argv[1]); printf("The %d -th arg is %s\n",i, argv[i]); } }
dan-seol/C
countWord206.c
<reponame>dan-seol/C #include <stdio.h> int main() { char string[99999] = "The quick brown fox jumped over the pile of ice."; char *pos = string; unsigned int words = 0; while(*pos) { if(*pos == ' ' || *pos == '.') { words++; } printf("Procesing character %c with w...
dan-seol/C
ctChar.c
<reponame>dan-seol/C #include <stdio.h> int main(void) { long nc= 0; while(getchar() != '\0'){ nc++; printf("%ld\n", nc); } return 0; }
dan-seol/C
arraysol1.c
<gh_stars>0 #include <stdio.h> #include <math.h> int main(int argc, char *argv[]){ const int array_length = 11; float account_balances[array_length]; for(int pos=0; pos<array_length; pos++){ account_balances[pos] = expf(pos); printf("The value of e to the power %d is %f \n", (pos), account_balances[pos]); } }
dan-seol/C
arrayex.c
<gh_stars>0 #include <stdio.h> int main(int argc, char *argv[]){ int hourly_prices[2] = {2,4}; for(int) printf("%d\n", *hourly_prices); }
dan-seol/C
filesortingdave.c
<reponame>dan-seol/C<filename>filesortingdave.c<gh_stars>0 /* FILE: sorting_excersize_starter_dave.c * * Please fill this in with some code to sort. You can use the * linear sort algorithm suggested on the Lecture 6 slides * or something you learned in a previous course. * Good luck! * * Author: <NAME> * Date: ...
dan-seol/C
sortVocab.c
<gh_stars>0 #include <stdio.h> #include <stdlib.h> #include <string.h> void sort_words(char *words[], int count) { char *x; for(int i=0; i<count; i++) { for(int j= i+1; j<count; j++) { if(strcmp(words[i], words[j]) > 0) { x = words[j]; words[j] = words[i]; words[i...
dan-seol/C
LARA/matrix.c
#include <stdio.h> #include <stdlib.h> #include <time.h> #define ROWS 5 #define COLS 5 //1. fillMatrix void fillMatrix(int matrix[ROWS][COLS]) { srand(time(0)); for(int i = 0; i < ROWS; i++) { for(int j = 0; j < COLS; j++) { matrix[i][j] = (rand() % 100) + 1; } } } //2. printMatrix...
dan-seol/C
simplecalc.c
<filename>simplecalc.c<gh_stars>0 #include <stdio.h> #include <string.h> #include <stdlib.h> int main(int argc, char *argv[]){ int l; l = atoi(argv[1]); for(int i=2; i<argc; i= i + 2){ if(strcmp(argv[i], "+")==0){ l = l + atoi(argv[i+1]); } else if (strcmp(argv[i], "-")==0){ l = l-atoi(argv...
dan-seol/C
LARA/database.c
<filename>LARA/database.c #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #define SIZE 1024 typedef struct Record { int ID; char NAME[SIZE]; int AGE; double GPA; } Record; typedef struct node { Record val; struct node *next; } node_r; void trimSpace(const char *input, char *...
dan-seol/C
strstrTest.c
<gh_stars>0 #include <stdio.h> #include <string.h> int main (int argc, char* argv[]) { char haystack[256]; char needle[256]; if(argc != 3){ printf("ERROR: Please type in two strings"); return 1; } strcpy(haystack, argv[1]); strcpy(needle, argv[2]); if(strlen(haystack) < strlen(needle)){ p...
dan-seol/C
strTOK.c
#include <string.h> #include <stdio.h> int main () { char str[80] = "This is - www.tutorialspoint.com - website"; const char s[2] = "-"; const char t[2] = " "; char *token; /* get the first token */ /* walk through other tokens */ while( token != NULL ) { printf( " %c\n", *token ); ...
dan-seol/C
q1b_sierpinski_diamond.c
<filename>q1b_sierpinski_diamond.c #include <stdio.h> #include <stdlib.h> // Used for atoi() function #include <string.h> // Used for strlen() function #include <math.h> int power2(int m){ if(m==0){ return 1; } else if (m < 0) { // positive integer assumes printf("This function is defined for nonnegative in...
dan-seol/C
ts.c
#include <stdio.h> int main(int argc, char *argv[]){ int array[4] = {1,2,3,4}; for(int i=0; i<100; i++){ printf("%d, %d", i, array[i]); } }
dan-seol/C
LARA/ssv.h
#include <stdio.h> #include <string.h> #include <stdlib.h> void parse(char record[], int *acct, float *amnt) { sscanf(record, "%d %f", acct, amnt); }
dan-seol/C
q2_extract_wiki_links.c
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <limits.h> #include <math.h> // It can take multiple downloaded pages at once. //EXAMPLE OUTPUT from // $ ./a.out <NAME> // int main(int argc, char* argv[]){ for(int i =1; i<argc; i++){ printf("Here is your %d-th article.", i); char* fname ...
dan-seol/C
ptrr.c
#include <stdio.h> void swap(int* i, int* j){ int k; k = *i; *i = *j; *j = k; } int main(int argc, char* argv[]) { int x = 3; int y = 4; int* a = &x; int* b = &y; swap(a, b); printf("%d, %d\n", *a, *b); return 0; }
dan-seol/C
Quiz3Q4.c
<reponame>dan-seol/C #include <stdio.h> int main(void){ unsigned char c = 'c'; unsigned char d = ( c >> 3 ) << 3; printf("%c\n", c); printf("%c\n", d); unsigned char e = c * 8; printf("%c\n", c >> 2); printf("%c\n", c << 2); return 0; }
dan-seol/C
progsol.c
#include <stdio.h> #include <math.h> #include <limits.h> #include <stdlib.h> int main(int argc, char* argv[]){ int array[argc-1]; for(int pos=1; pos<argc; pos++) array[pos-1] = atoi(argv[pos]); for(int pos=0; pos<argc-1; pos++){ int curr = array[pos]; int min_pos = -1; int min_val = INT_MAX; ...
dan-seol/C
q2_extract_wiki_links_attempt.c
<gh_stars>0 #include <stdio.h> #include <string.h> #include <stdlib.h> #include <limits.h> //char article[20] = "<a href= \"/wiki/"; //char title[7] = "title="; //char quote[2] = "\""; //const char* filename = arg; //char *ref; //char *token1; //char *token2; int main(int argc, char *argv[]){ for(int i =1; i<argc;...
dan-seol/C
Q3Q4.c
<filename>Q3Q4.c //COMP 206 Quiz 3 Question 4 #include <stdio.h> int* f( int size, int *ptr ){ int array[size]; array[0] = 1; return &size; } int main(){ int i = 5; int *p = f( i, &i ); i = p[0]; printf( "The value of i is %d.\n", i ); return 0; }
dan-seol/C
jk.c
<reponame>dan-seol/C<filename>jk.c #include <stdio.h> int main(void){ short int i=0; while(1){ printf("i is %d.\n", i); i++; } }
dan-seol/C
template.c
#include <stdio.h> #include <string.h> int main(int argc, char *argv[]){ }
dan-seol/C
q1b_Alison.c
#include <stdio.h> #include <stdlib.h> #include <math.h> //This method prints out the space at the beginning and end of the triangle int printSpace(int y, int height, int level){ //get the height of the triangle double tri_height = ceil(height/2.0); //use a for loop to print out spaces for(int x = 0...
dan-seol/C
stringtest.c
<filename>stringtest.c #include <stdio.h> int main(int argc, char *argv[]){ char name[100] = "Daniel"; char sis[100] = "Anne"; char mom[100] = "Heewon"; int c = 0; //char s[100]; // gets(s); input from the user. while (name[c] != '\0') { printf("%c", name[c]); c++; } printf("\n"); c=0; while (sis[c] != '\0...
dan-seol/C
q2_Alison.c
<gh_stars>0 #include <stdio.h> #include <string.h> int main(int argc, char* argv[]){ //return an error statement if there is not the right amount of arguments if(argc != 2){ printf("ERROR: You must have 1 argument."); return -1; } //save the first argument as the filename const ch...
dan-seol/C
ctChar2.c
<reponame>dan-seol/C #include <stdio.h> /* count characters in input; 2nd version */ int main(int argc, char* argv[]){ double nc; for(nc = 0; getchar() != EOF; ++nc){ ; printf("%.0f\n", nc); } return 0; }
dan-seol/C
func.c
#include <stdio.h> int cumsum(int a, int b){ // returns the sum_{i=a}^{b} i int val = 0; for(int i = a; i < b+1; i++){ val += i; } return val; } int main(void){ printf("The sum of all integers from %d to %d is %d\n", 3, 10, cumsum(3,10)); printf("The sum of all integers from %d to %d is %d\...
dan-seol/C
FC_for.c
#include <stdio.h> int main(void){ int j; for(int i= 0; i< 300; i +=20){ j = 5*(i-32)/9; printf("%d\t%d\n",i, j); } }
dan-seol/C
midQ6.c
#include <stdio.h> #include <string.h> int main(void){ char *my_word_array[3] = {NULL, NULL, NULL}; char first[100] = "one"; my_word_array[0] = first; my_word_array[1] = "two"; char third[100]; third[0] = '3'; my_word_array[2] = third; // strcpy(my_word_array[3], "4"); printf("Th...
dan-seol/C
q1a_simple_diamond.c
<reponame>dan-seol/C<filename>q1a_simple_diamond.c #include <stdio.h> #include <stdlib.h> // Used for atoi() function #include <string.h> // Used for strlen() function #include <math.h> #define TRUE 1 #define FALSE 0 void line(int n, int m){ for(int i=0; i<n; i++){ if((n/2)-(m) < i && i <= n/2){ printf("*...
dan-seol/C
midQ7.c
<gh_stars>0 #include <stdio.h> int main(void) { int i=2; int x =3; while(1){ x = x+x; break; } for(i = i+i; i<x; x++){ i = i+i; } printf("%d %d\n", x, i); return 0; }
dan-seol/C
LARA/linked.h
<filename>LARA/linked.h #include <stdio.h> #include <string.h> #include <stdlib.h> typedef struct ACCOUNT { int accountNumber; float balance; struct ACCOUNT *next; } ACCOUNT; static ACCOUNT *head = NULL; static ACCOUNT *tail = NULL; void findUpdate(int account, float amount) { //you mean float amount, right? ...
dan-seol/C
memsetTest.c
#include <stdio.h> #include <string.h> #include <stdlib.h> int main(int argc, char* argv[]){ if(argc != 3){ printf("ERROR: please type in a string and a positive integer\n"); return 0; } int arg2 = atoi(argv[2]); if(arg2 <1 ){ printf("ERROR: please type in a strictly positive integer\n"); return 0; } if(...
dan-seol/C
strCmpTest.c
#include <stdio.h> #include <string.h> //strcmp() : Compares the ascii value of the first unmatched character //Compares two strings int main(int argc, char* argv[]){ if(argc != 3){ printf("ERROR: please type in a string and a positive integer\n"); return 0; } char s1[256]; char s2[256]; strcpy(s1, argv[1]); ...
dan-seol/C
stringLen.c
<filename>stringLen.c #include <stdio.h> #include <string.h> #include <stdlib.h> int main(int argc, char *argv[]){ for(int i = 1; i< argc; i++){ int length = 0; char* pos = argv[i]; while(*pos){ // the pointer towards \0 gets to be evaluated as zero pos++; length++; } pri...
dan-seol/C
sorting_exercise_starter.c
/* FILE: sorting_excersize_starter.c * * Please fill this in with some code to sort. You can use the * linear sort algorithm suggested on the Lecture 6 slides * or something you learned in a previous course. * Good luck! * * Author: <NAME> * Date: Sept 19, 2018 */ #include <stdio.h> int main(){ int array...
dan-seol/C
arithmetictest.c
<gh_stars>0 #include <stdio.h> #include <math.h> int power2(int m){ if(m==0){ return 1; } else if (m < 0) { // positive integer assumes printf("This functions is defined for nonnegative integers only"); return -1; } else { return 2*power2(m-1); } } int main(void){ int n = 5; printf("%d\n",...
dan-seol/C
countChar.c
#include <stdio.h> int main(int argc, char *argv[]){ char s[100] = "Rahman"; char t[100]; int a = 0; int b = 0; printf("Type in a word:"); fgets(t, 99, stdin); while(s[a] != '\0'){ a++; } while(t[b] != '\0'){ b++; } printf("The word \'Rahman\' has %d characters\n", a); printf("The word you ...
dan-seol/C
LARA/reverse.c
#include <stdio.h> int getLength(char* str) { int length = 0; char* pos = str; while (*pos) { //Every string in C is stored as an array of char's. e.g. "Hello" is stored as {'H', 'E', 'L', 'L', 'O', '\0'}. //Something to take away is that the pointer (in our case, it will be *pos) towards '\0' will be evaluate...
dan-seol/C
countLn.c
#include <stdio.h> /* count characters in input; 2nd version */ int main(int argc, char* argv[]){ int c, n1; n1 = 0; while ((c = getchar()) != EOF) { if(c == '\n'){ ++n1; } printf("%d\n", n1); } return 0; }
dan-seol/C
wFile.c
#include <stdio.h> #include <stdlib.h> int main () { FILE * fp; fp = fopen ("file.txt", "w+"); fprintf(fp, "%s %s %s %d", "We", "are", "in", 2012); fclose(fp); return(0); }
dan-seol/C
FC_constant.c
<filename>FC_constant.c #include <stdio.h> #define LOWER 0 #define UPPER 300 #define STEP 20 int main(void){ float F, C; int lower, upper, step; F = LOWER; while(F <= UPPER){ C = (5.0/9.0)*(F-32); printf("%3.2f\t%3.3f\n", F, C); F += STEP; } }
dan-seol/C
FC_float.c
#include <stdio.h> int main(void){ float F, C; int lower, upper, step; lower = -20; upper = 300; step = 20; F = lower; while(F <= upper){ C = (5.0/9.0)*(F-32); printf("%3.2f\t%3.0f\n", F, C); F += step; } }
dan-seol/C
LARA/main.c
#include <stdio.h> #include <string.h> #include <stdlib.h> #include "ssv.h" #include "linked.h" #define SIZE 1024 int main(){ int *idTracker = (int*) malloc(sizeof(int)); float *balanceTracker = (float*) malloc(sizeof(float)); FILE *fp = fopen("students.ssv", "r"); char record[SIZE]; while(fgets(record, 2*S...
dan-seol/C
howLarge.c
#include <stdio.h> #include <stdlib.h> #include <string.h> int main () { FILE *fp = fopen("file.txt","r"); size_t sz; fseek(fp, 0L, SEEK_END); sz = ftell(fp); rewind(fp); char file_data_array[sz+1]; fread(file_data_array, 1, sz+1, fp); printf("File contents:\n%s\n", file_data_array); printf("%lu\n"...
dan-seol/C
midQ5.c
#include <stdio.h> void swap(int* i, int* j){ int k; k = *i; *i = *j; *j = k; } int main(void){ int a =2; int b= 3; int *temp = &a; swap(temp, &b); printf("%d %d %d \n", a, b, *temp); return 0; }
dan-seol/C
countLine.c
<reponame>dan-seol/C<filename>countLine.c<gh_stars>0 #include <stdio.h> #include <stdlib.h> #define BUFFSIZE 1024 int countlines( FILE *fin) { int nlines = 0; char line[BUFFSIZE]; while(fgets(line, BUFFSIZE, fin) != NULL) { nlines++; } return nlines; } int main(int argc, char *argv[]) { ...
TheDukeFamily/EnableAudioVideo
playVideo/playVideo/GGStartMovieHelper.h
<filename>playVideo/playVideo/GGStartMovieHelper.h<gh_stars>0 // // GGStartMovieHelper.h // playVideo // // Created by Mac on 2018/6/11. // Copyright © 2018年 Mr.Gao. All rights reserved. // #import <Foundation/Foundation.h> @interface GGStartMovieHelper : NSObject + (instancetype)shareInstance; + (void)showStar...
TheDukeFamily/EnableAudioVideo
playVideo/playVideo/UIImage+LaunchImage.h
<reponame>TheDukeFamily/EnableAudioVideo // // UIImage+LaunchImage.h // StartAppWithLaunchMovie // // Created by 邓法芝 on 2017/7/8. // Copyright © 2017年 邓法芝. All rights reserved. // #import <UIKit/UIKit.h> @interface UIImage (LaunchImage) + (instancetype)getLaunchImage; @end
TheDukeFamily/EnableAudioVideo
playVideo/playVideo/GGStartMovieView.h
// // GGStartMovieView.h // playVideo // // Created by Mac on 2018/6/11. // Copyright © 2018年 Mr.Gao. All rights reserved. // #import <UIKit/UIKit.h> @interface GGStartMovieView : UIView + (instancetype)movieView; @property (nonatomic,strong) NSURL *movieURL; @end
KentWind/TX23-UReadings
internetConn.h
<gh_stars>1-10 #ifndef internetConn_h #define internetConn_h /* Circuit: Ethernet shield attached to pins 10, 11, 12, 13 */ #include <SPI.h> #include <Ethernet.h> // Initialize the Ethernet client library // with the IP address and port of the server // that you want to connect to (port 80 is default for HTTP):...
KentWind/TX23-UReadings
TX23Manipulations.h
<filename>TX23Manipulations.h #ifndef TX23manipulations_h #define TX23manipulations_h #include <LaCrosse_TX23.h> class TX23manipulations{ public: float metersToMiles(float speed); float getMeterToMile(); void printTX23Data(LaCrosse_TX23 anemometer); int getDir(); int getSpeed(); private: ...
abakobo/monkey2
modules/steamworks/marshal.h
<filename>modules/steamworks/marshal.h #ifndef MARSHAL_H #define MARSHAL_H #include <bbmonkey.h> #include <steam_api.h> //public delegate void SteamAPI_LeaderboardFindResult_t_CallResult(LeaderboardFindResult_t pLeaderboardFindResult_t, bool bIOFailure); enum SteamEventType{ StatsReceived, StatsStored, Leaderboa...
abakobo/monkey2
modules/m2conio/native/posix_input.h
#ifndef POSIX_INPUT_H #define POSIX_INPUT_H int getch(void); int kbhit(void); #endif
houbin/alarm
public/user_interface_defines.h
#ifndef user_interface_defines_h__ #define user_interface_defines_h__ #ifdef WIN32 #include <winsock2.h> #include <windows.h> #endif #include <string> #include <vector> #include <string.h> #include <time.h> #include <stdint.h> /** * @brief 用户基本信息 */ typedef struct userInfo_ { std::string...
houbin/alarm
userOnline/src/user_alive.h
<filename>userOnline/src/user_alive.h #ifndef DEVICE_ALIVE_H_ #define DEVICE_ALIVE_H_ #include "push_msg_queue.h" #include "../../util/http_client.h" extern PushMsgQueue *g_msg_push_queue; extern HttpClient *g_http_client; extern void ClearGuidFdCache(); extern int StartHttpClient(); #endif
houbin/alarm
voice_server/include/socket_wrapper.h
<gh_stars>0 /** * @created: 2012/05/18 * * @file socket_wrapper.h * * @author <NAME> <<EMAIL>> * * @version 1.0 * * @LICENSE * * @brief 对socket操作的封装处理 * */ #ifndef SOCKET_WRAPPER_H__ #define SOCKET_WRAPPER_H__ #include <sys/socket.h> #in...
houbin/alarm
userOnline/src/json_opt.h
/* * json_opt.h * * Created on: Mar 6, 2013 * Author: yaowei */ #ifndef JSON_OPT_H_ #define JSON_OPT_H_ #include "libjson/libjson.h" #include "libjson/_internal/Source/JSONNode.h" #include "../../public/user_interface_defines.h" #include "defines.h" using namespace std; class CJsonOpt { public: CJson...
houbin/alarm
voice_server/util/clock.h
<gh_stars>0 #ifndef UTIL_CLOCK_H_ #define UTIL_CLOCK_H_ #include "utime.h" namespace util { extern UTime GetClockNow(); } #endif
houbin/alarm
voice_server/util/utime.h
#ifndef UTIL_UTIME_H_ #define UTIL_UTIME_H_ #include <sys/time.h> #include <math.h> #include <stdint.h> namespace util { class UTime { public: uint32_t tv_sec; uint32_t tv_nsec; bool IsZero() { return ((tv_sec == 0) && (tv_nsec == 0)); } void normalize() { if (tv_nsec > ...
houbin/alarm
voice_server/util/logger.h
<reponame>houbin/alarm<filename>voice_server/util/logger.h<gh_stars>0 #ifndef UTIL_LOGGER_H_ #define UTIL_LOGGER_H_ #include <stdio.h> #include <string.h> #include <string> #include <sys/time.h> #include <time.h> #include <stdint.h> #include <pthread.h> #include <stdarg.h> #include <assert.h> #include <boost/scoped_pt...
houbin/alarm
userOnline/src/context.h
#ifndef UTIL_CONTEXT_H_ #define UTIL_CONTEXT_H_ namespace util { class Context { private: // no copying allowed Context(const Context& other); const Context& operator=(const Context& other); protected: virtual void Finish(int r) = 0; public: Context() {} virtual ~Context() { } virtual v...
houbin/alarm
voice_server/src/dispatcher.h
<reponame>houbin/alarm<gh_stars>0 #ifndef DISPATCHER_H_ #define DISPATCHER_H_ #include <stdint.h> #include <string> #include "global.h" #include "json_opt.h" #include "connection.h" #include "voice_channel.h" #include "push_msg_timer_queue.h" using namespace std; class PushMsgContext; struct ConnectionInfo; class D...
houbin/alarm
voice_server/util/mutex.h
<gh_stars>0 #ifndef UTIL_MUTEX_H_ #define UTIL_MUTEX_H_ #include <pthread.h> namespace util { class Mutex { private: const char *name_; pthread_mutex_t m_; // no copying Mutex(const Mutex &); void operator=(const Mutex &); public: Mutex(const char *name); ~Mutex(); void Lock(); ...
houbin/alarm
voice_server/src/connection.h
#ifndef TCP_SERVER_CONNECTION_H_ #define TCP_SERVER_CONNECTION_H_ #include <event.h> #include <string> #include "tlv_define.h" class Worker; struct ConnectionInfo { uint64_t conn_id; int cfd; std::string cip; uint16_t cport; struct bufferevent *buffer_event; char in_buffer[CONN_BUFFER_LE...
houbin/alarm
userOnline/src/worker_threads.h
<reponame>houbin/alarm<filename>userOnline/src/worker_threads.h /* * CThread.h * * Created on: Mar 4, 2013 * Author: yaowei */ #ifndef WORK_THREAD_H_ #define WORK_THREAD_H_ #include <vector> #include <boost/thread.hpp> #include "defines.h" #include "redis_opt.h" class CWorkerThread { public: CWorkerTh...
houbin/alarm
public/utils.h
<reponame>houbin/alarm /** * @created: 2012/05/16 * * @file utils.h * * @author <NAME> <<EMAIL>> * * @version 1.0 * * @LICENSE * * @brief 通用工具方法 * */ #ifndef UTILS_H__ #define UTILS_H__ #include <netinet/in.h> #include <sys/time.h> #incl...
houbin/alarm
deviceOnline/src/test.h
#ifndef TEST_H_ #define TEST_H_ #include "thread.h" using namespace util; class TestThread : public Thread { private: public: TestThread() { } ~TestThread() { } void *Entry(); }; #endif
houbin/alarm
deviceOnline/src/defines.h
/* * defines.h * * Created on: 2012-9-12 * Author: yaowei */ #ifndef DEFINES_H_ #define DEFINES_H_ #include <assert.h> #include <string.h> #include <pthread.h> #include <stdlib.h> #include <errno.h> #include <arpa/inet.h> #include <boost/shared_ptr.hpp> #include <boost/thread.hpp> #include <boost/thread/t...
houbin/alarm
userOnline/src/threadSafe_map.h
<reponame>houbin/alarm #ifndef THREAD_SAFE_MAP_H_ #define THREAD_SAFE_MAP_H_ #include <boost/thread.hpp> #include <map> template<typename K, typename V> class CThreadSafeMap { public: CThreadSafeMap() {} ~CThreadSafeMap() { if (!map_.empty()) { map_.clear(); } } ...
houbin/alarm
voice_server/include/errcode.h
<reponame>houbin/alarm #ifndef TCPSERVER_ERRCODE_H_ #define TCPSERVER_ERRCODE_H_ #endif
houbin/alarm
voice_server/util/env_posix.h
<filename>voice_server/util/env_posix.h<gh_stars>0 #ifndef UTIL_ENV_POSIX_H_ #define UTIL_ENV_POSIX_H_ #include <string> #include "env.h" using namespace std; namespace util { class PosixWritableFile : public WritableFile { private: string filename_; FILE *file_; size_t written_bytes_; public: Posi...
houbin/alarm
deviceOnline/src/device_alive.h
<reponame>houbin/alarm<filename>deviceOnline/src/device_alive.h #ifndef DEVICE_ALIVE_H_ #define DEVICE_ALIVE_H_ #include "push_msg_queue.h" #include "../../util/http_client.h" extern PushMsgQueue *g_push_msg_queue; extern HttpClient *g_http_client; extern void ClearDeviceCache(); extern int StartHttpClient(); #endi...
houbin/alarm
voice_server/src/global.h
#ifndef TCPSERVER_GLOBAL_H_ #define TCPSERVER_GLOBAL_H_ #include "../util/logger.h" #include "../util/config.h" extern util::Logger *g_logger; extern util::Config *g_config; #define DATA_PROTOCOL_JSON "json" #define DATA_PROTOCOL_TLV "tlv" #endif
houbin/alarm
voice_server/util/context.h
#ifndef UTIL_CONTEXT_H_ #define UTIL_CONTEXT_H_ namespace util { class Context { private: // no copying allowed Context(const Context& other); const Context& operator=(const Context& other); protected: virtual void Finish(int r) = 0; public: Context() {} virtual ~Context() ...
houbin/alarm
deviceOnline/src/logic_opt.h
<gh_stars>0 /* * message_opt.h * * Created on: Mar 18, 2013 * Author: yaowei */ #ifndef MESSAGE_OPT_H_ #define MESSAGE_OPT_H_ #include "defines.h" #include "redis_opt.h" #include "../../public/message.h" #include "../../public/user_interface_defines.h" #include "libjson/_internal/Source/JSONNode.h" class ...
houbin/alarm
voice_server/src/voice_channel.h
<reponame>houbin/alarm #ifndef VOICE_CHANNEL_ #define VOICE_CHANNEL_ #include <map> #include "global.h" #include <event.h> using namespace std; using namespace util; struct ClientVcInfo { string client_id; int client_fd; struct bufferevent *client_bev; string dev_id; }; struct DevVcInfo { strin...
houbin/alarm
voice_server/util/rwlock.h
<reponame>houbin/alarm #ifndef UTIL_RWLOCK_H_ #define UTIL_RWLOCK_H_ #include <pthread.h> #include <assert.h> namespace util { class RWLock { private: mutable pthread_rwlock_t rwlock_; const char *name_; public: RWLock(const char *name) : name_(name) { pthread_rwlock_init(&rwlock_, NULL)...
houbin/alarm
userOnline/src/redis_conn_pool.h
<reponame>houbin/alarm /* * redis_conn_pool.h * * Created on: Apr 9, 2013 * Author: yaowei */ #ifndef REDIS_CONN_POOL_H_ #define REDIS_CONN_POOL_H_ #include <deque> #include <hiredis/hiredis.h> #include "defines.h" typedef struct redisConnInfo_ { int max_conn_num; std::string ip; int port; } R...
houbin/alarm
voice_server/util/cond.h
#ifndef UTIL_COND_H_ #define UTIL_COND_H_ #include <pthread.h> #include <assert.h> #include "mutex.h" #include "utime.h" namespace util { class Cond { private: pthread_cond_t cond_; Mutex *waiter_mutex_; // no copying allowed Cond(const Cond &); void operator=(Cond &c); public: Cond(); ...
houbin/alarm
userOnline/src/master_thread.h
<reponame>houbin/alarm /* * net_core.h * * Created on: Mar 4, 2013 * Author: yaowei */ #ifndef MASTER_THREAD__H_ #define MASTER_THREAD__H_ #include "defines.h" #include "threadSafe_map.h" class CWorkerThread; class CMasterThread { public: CMasterThread(); virtual ~CMasterThread(); public: b...
houbin/alarm
voice_server/util/common.h
#ifndef UTIL_COMMON_H_ #define UTIL_COMMON_H_ namespace util { void safe_close(int fd); bool set_socket_noblock(const int sock_fd); } #endif
houbin/alarm
voice_server/src/tlv_define.h
<gh_stars>0 #ifndef TLV_DEFINE_H_ #define TLV_DEFINE_H_ enum { TYPE_LENGTH = 0, TYPE_MID = 1, TYPE_CLIENT_ID = 2, TYPE_DEV_ID = 3, TYPE_HEARTBEAT = 4, TYPE_ON_HEARTBEAT = 5, TYPE_CLIENT_BUILD_VC = 1000, TYPE_...
houbin/alarm
deviceOnline/src/global_settings.h
/* * global_settings.h * * Created on: Mar 12, 2013 * Author: yaowei */ #ifndef GLOBAL_SETTINGS_H_ #define GLOBAL_SETTINGS_H_ #include <string> class CGlobalSettings { public: std::string public_addr_; std::string private_addr_; int remote_listen_port_; unsigned int thread_num_; int l...
houbin/alarm
voice_server/src/push_msg_timer_queue.h
#ifndef PUSH_MSG_TIMER_QUEUE_H_ #define PUSH_MSG_TIMER_QUEUE_H_ #include <map> #include "../util/mutex.h" #include "../util/cond.h" #include "../util/utime.h" #include "../util/thread.h" #include "../util/atomic.h" #include "../util/coding.h" #include "../util/context.h" #include "../include/socket_wrapper.h" #include...
houbin/alarm
voice_server/src/master.h
<filename>voice_server/src/master.h #ifndef TCP_SERVER_MASTER_H_ #define TCP_SERVER_MASTER_H_ #include <stdint.h> #include <vector> #include <event.h> #include <netinet/in.h> #include <arpa/inet.h> #include "../util/thread.h" #include "../util/mutex.h" #include "../util/cond.h" #include "global.h" #include "dispatcher...
houbin/alarm
public/config_file.h
<filename>public/config_file.h // ConfigFile.h // Class for reading named values from configuration files // <NAME> v2.1 24 May 2004 <EMAIL> // Copyright (c) 2004 <NAME> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files ...