Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions HashMap/HashMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class HashMap
||
|| @return The key at index idx
*/
K keyAt(unsigned int idx)
const K& keyAt(unsigned int idx)
{
return keys[idx];
}
Expand Down Expand Up @@ -104,7 +104,7 @@ class HashMap
||
|| @return The const value for key
*/
const V& operator[](const K key) const
const V& operator[](const K& key) const
{
return operator[](key);
}
Expand All @@ -120,7 +120,7 @@ class HashMap
||
|| @return The value for key
*/
V& operator[](const K key)
V& operator[](const K& key)
{
if (contains(key))
{
Expand All @@ -145,7 +145,7 @@ class HashMap
||
|| @return The index of the key, or -1 if key does not exist
*/
unsigned int indexOf(K key)
unsigned int indexOf(const K& key)
{
for (int i = 0; i < currentIndex; i++)
{
Expand Down Expand Up @@ -176,7 +176,7 @@ class HashMap
||
|| @return true if it is contained in this HashMap
*/
bool contains(K key)
bool contains(const K& key)
{
for (int i = 0; i < currentIndex; i++)
{
Expand Down Expand Up @@ -205,7 +205,7 @@ class HashMap
||
|| @parameter key the key to remove from this HashMap
*/
void remove(K key)
void remove(const K& key)
{
int index = indexOf(key);
if (contains(key))
Expand Down
70 changes: 70 additions & 0 deletions Logger.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#ifndef LOGGER_H
#define LOGGER_H

#define LOGGER_ENABLED 1

#if LOGGER_ENABLED
inline void LogPrint(const char** table, int index)
{
int len = strlen(table[index]);
char buffer[len+1];
strcpy(buffer, table[index]);
Serial.print(buffer);
}

inline void LogPrintLn(const char** table, int index)
{
int len = strlen(table[index]);
char buffer[len+1];
strcpy(buffer, table[index]);

Serial.println(buffer);
Serial.flush();
}

inline void LogPrint(const String& text)
{
Serial.print(text);
}

inline void LogPrintLn(const String& text)
{
Serial.println(text);
Serial.flush();
}

inline void LogPrint(const char text[])
{
Serial.print(text);
}

inline void LogPrintLn(const char text[])
{
Serial.println(text);
Serial.flush();
}

inline void LogPrint(const int value)
{
Serial.print(value);
}

inline void LogPrintLn(const int value)
{
Serial.println(value);
Serial.flush();
}

#else

inline void LogPrint(...)
{
}

inline void LogPrintLn(...)
{
}

#endif
#endif

Loading